in reply to Re^6: To initialise or not to initialise?
in thread To initialise or not to initialise?
When you loop over a list, the local variable is aliased to each member of the list.
Yes, I got that part. The part that surprises me is that B::Deparse deparses it to something that doesn't work, and I always assumed that the deparsing was correct. Consider:
This code doesn't run, and it is what I mistakenly assumed your code was the equivalent of (minus the use's and print).use strict; use warnings; foreach $_ (my ($foo, $bar, $baz)) { $_ = "default"; } print "$foo\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: To initialise or not to initialise?
by tilly (Archbishop) on Jun 24, 2004 at 23:30 UTC | |
|
Re^8: To initialise or not to initialise?
by Hofmator (Curate) on Jun 25, 2004 at 08:42 UTC | |
by runrig (Abbot) on Jun 25, 2004 at 18:25 UTC | |
by Hofmator (Curate) on Jun 28, 2004 at 09:11 UTC |