in reply to text file problem
Another way:my $buffer = ""; while (<FH>) { next unless /\S/; # Skip blank lines. if (/^\D/) { # A bar is a non-digit as well. chomp $buffer; $buffer .= $_; next; } print $buffer; $buffer = $_; } print $buffer;
my $nl = ""; while (<FH>) { next unless /\S/; $nl = chomp; print $nl unless /^\d/ || $. == 1; print; } print $nl; # Prints newline if we saw at least one non-blank file.
|
|---|