while loop - How do I detect an empty line from input or a file in Perl? -
while ($_ ne ' \n') doesn't detect if input empty line , loop indeterminately in while. why?
depends mean "an empty line".
does line contain no characters other newline?
if ($_ eq "\n") # note, \n means newline in double quoted string. or
if (/^$/) does line contain whitespace characters
if (/^\s*$/) but easier if invert logic line doesn't include non-whitespace characters
if (! /\s/) one of should want.
Comments
Post a Comment