Problems? Is your data what you think it is? | |
PerlMonks |
Re: Empty STDIN does not exit while loopby Discipulus (Canon) |
on May 20, 2017 at 07:37 UTC ( [id://1190700]=note: print w/replies, xml ) | Need Help?? |
After chomping, check what remains; exit the loop if nothing is found.
UPDATE: Additionally if move the chomp inside the loop you can use CTRL-Z to end fidding STDIN Notice that chomp returns the number of removed chars, not the chomped string (added in the same time of the below answer..). Considering this and avoiding extra variable $line you can have anything in the while condition:
L*
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
In Section
Seekers of Perl Wisdom
|
|