laziness, impatience, and hubris | |
PerlMonks |
Re: foreach not doing what I expect it to be doingby revdiablo (Prior) |
on Feb 08, 2006 at 21:19 UTC ( [id://528939]=note: print w/replies, xml ) | Need Help?? |
You are creating an array with only a single element. That single element happens to be an array reference. So the foreach loop is working how you expect, it's your earlier assignment that isn't. You might have better luck by dereferencing the arrayref on assignment (note, this makes a copy. Depending on the circumstances, that may be bad):
See also perlreftut for a nice references tutorial, or perlref for the full reference docs.
In Section
Seekers of Perl Wisdom
|
|