Home >>
Type Glob
If you prefix the name of a Perl variable with an '*', you can
refer to ALL the Perl objects (scalars, arrays, filehandles,
subroutines) which have that name
Called a type glob (since the * represents a $ or @ or %)
When a type glob is assigned to another type glob, object
aliasing is set up.
It is recommended that type globs be used as lvalues only inside
local(). Otherwise, you may clobber an existing variable!
Ex:
@x = (5, 6, 7);
&sub1 (*x);
sub sub1
{
local (*array) = @_;
# Now any references to @array in the subroutine
# are really references to the global array @x.
# Be careful! All objects with name x have been
# aliased. References to $array inside the subroutine
# will reference a global $x; same with %array
# and %x.
# But now any array operation (for example, push/pop)
# can be done on @array and the changes made to the
# global @x.
}
Perl functions
|
call a stored procedure Home perl hello world!
Download perl
download stable version of perl
Perl 5.10.1
|
|