Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Hmmm: while(), file handle and $_ gotchaby roboticus (Chancellor) |
on Mar 06, 2009 at 12:35 UTC ( [id://748833]=perlquestion: print w/replies, xml ) | Need Help?? |
roboticus has asked for the wisdom of the Perl Monks concerning the following question:
Hello, all--
I've got a question that I can't answer[1]. Given this code:
I expected to see this:
So imagine my surprise when I saw this:
By changing the two commented lines, I get the desired output, so my program works now. But I can't rest until I know what's causing this behavior. I expect that it has something to do with the nested while and for loops and some interaction with $_. [1] I've tried to answer it myself, but have been unsuccessful.
Can someone whack me with a cluestick? I'd really appreciate it... Update: Thanks to everyone who replied. I updated my script and added it to the Code Catacombs. ...roboticus
Back to
Seekers of Perl Wisdom
|
|