Perl-Sensitive Sunglasses | |
PerlMonks |
Mutable foreach list?by zigdon (Deacon) |
on Jan 11, 2007 at 15:19 UTC ( [id://594174]=perlquestion: print w/replies, xml ) | Need Help?? |
zigdon has asked for the wisdom of the Perl Monks concerning the following question: I was talking to a friend about foreach aliasing the loop variable one by one through the list provided... As he was playing around with it, came across this: Which produces:
And I say huh? I follow until output line "7:". I can even see why it would run 3 more times (since the list fed to foreach was evaluated before @body was modified). What I don't get is how the next 3 elements of @headers get in there? Is this part of the "don't mess with the loop vars while looping" clause? What am I missing? -- zigdon
Back to
Seekers of Perl Wisdom
|
|