in reply to replace multiple newline characters
Update:my @newlines = grep{/\S/}@lines; #move only lines that have #a non whitespace char to the left or @lines = grep{/\S/}@lines;
For input I normally allow any number of "unseeable" whitespace chars. A blank line often may have an extra space in it that you can't see, especially if the input file is something that a human might edit.
while (<FH>) # update: was: while (my $line = <FH>) # don't really need "my line" here { next unless /\S/; #skip blank lines next if /^\s*#/; #skip comments, or whatever... blah, blah }
|
|---|