my $line =<STDIN> is a line oriented I/O method. It returns a line when it sees the EOL (End Of Line) character sequence. If EOF happens before EOL, then it (added to post: should return the line as it does with C readline) However, in my case this returns "false" so this last "not quite complete line" is not processed.
At the moment, I do not know how to get this unusual "john" last line processed. I am sure that there is a way, but right now I don't know it. Of course in your texteditor, end the john line with "enter" and all will be fine.
Update: The symptoms that I am seeing above are on an ancient Win XP laptop. The result completely surprised me! It would be helpful if the OP can replicate my results.
Update2: Hauke D got it right at Re^3: Perl program to look into the phone directory and in case of a match, print the name along with the number
In reply to Re^3: Perl program to look into the phone directory and in case of a match, print the name along with the number
by Marshall
in thread Perl program to look into the phone directory and in case of a match, print the name along with the number
by dk27
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |