in reply to Re(4) Whether to use local()
in thread Whether to use local()
#!/usr/bin/perl -w $main::foo = 'global'; my $bar = "my"; print "foo is ",$foo,"\n"; print "my is ",$bar,"\n"; { local $foo; local $bar; # Dies here. print "foo is ",$foo,"\n"; print "foo is ",$main::foo,"\n"; print "bar is ",$bar,"\n"; } print "foo is ",$foo,"\n"; print "my is ",$bar,"\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re(6) Whether to use local()
by dmmiller2k (Chaplain) on Mar 16, 2002 at 13:18 UTC |