in reply to How do I test for a blank line when reading from a file?
Extending runrig's answer to cover the case where "blank" could include whitespace characters
(as merlyn's answer already does, negatively): Use /^\s*$/
As in:
while (<>) { print "blank line detected\n" if /^\s*$/; }
|
|---|