http://qs321.pair.com?node_id=355803


in reply to Parsing Multiple Lines.

Your routine already distinguishea between data lines and blank (well, nonword) ones. You just haven't used the information. Add an else clause to the end of the if ($line=~/(\w)/) { statement, like:

} else { print "This line intentionally left blank.\n"; }
For other ideas, you could chomp and then test length, or else test for not matching non-whitespace: $line !~ /\S/. Each suggestion accomodates a little different notion of which lines are considered blank.

You probably mean to print whole lines, rather than just what you captured ($1).

After Compline,
Zaxo