![]() |
|
Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^3: Homework helpby ikegami (Patriarch) |
on Oct 30, 2004 at 17:55 UTC ( #404045=note: print w/replies, xml ) | Need Help?? |
I would have predicted that the last unless defined would not work right on empty input b/c $_ still contains a "\n"It doesn't work on empty input. It works on eof/error. It's there to prevent the next two lines from giving "undefined value" warnings under use warnings. The last unless length that follows is what detects the empty string (since chomp removed the "\n" by then).
In Section
Seekers of Perl Wisdom
|
|