use strict;
my $foo = 1;
my $fum = 1;
print STDERR "variables are now: $foo $fum\n";
{
my $foo = 2;
$fum = 2;
&foo();
print STDERR "variables are now: $foo $fum\n";
}
sub foo {
print STDERR "variables are now: $foo $fum\n";
}
Resulting:
variables are now: 1 1 variables are now: 1 2 variables are now: 2 2as you wanted
In reply to Re: What is it I don't understand about perl scoping?
by youlose
in thread What is it I don't understand about perl scoping?
by brycen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |