- or download this
sub foo {
my $z = 4;
return $z;
}
- or download this
my $x;
{ my $var = 4;
...
}
# 'var' is now out of scope.
print $$x; # but this still prints "4".
- or download this
sub new_filehandle {
local *FH;
...
}
$x = new_filehandle();
- or download this
sub new_filehandle {
local *FH;
...
}
$x = new_filehandle();
- or download this
sub new_filehandle {
local *FH; # return of *FH is implied
}
$x = new_filehandle();
- or download this
$x = do { local *FH; }; # return of *FH is implied