in reply to Re^3: Lost anonymous subs
in thread Lost anonymous subs
No assignments and still, those subs each has its own $m. Or does the for my $m creates a new variable on each iteration?my @abc; for my $m qw/a b c/ { push @abc, sub { $m }; } print $_->() . "\n" for @abc;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Lost anonymous subs
by diotalevi (Canon) on Dec 10, 2004 at 15:02 UTC | |
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 |