in reply to Re^4: Lost anonymous subs
in thread Lost anonymous subs
The my() operator has a runtime effect of creating a new variable so each time you start that loop, you have a new variable to have potentially bound to. This also works if you write code like this.
my @abc; for my $m ( qw/a b c/ ) { push @abc, \ $m; } print @abc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Lost anonymous subs
by kappa (Chaplain) on Dec 10, 2004 at 15:27 UTC | |
by diotalevi (Canon) on Dec 10, 2004 at 16:20 UTC | |
by kappa (Chaplain) on Dec 10, 2004 at 16:23 UTC |