in reply to Re: Remove whitespace between lines
in thread Remove whitespace between lines

Thank you for the simple solution. It gives me the error of "use of uninitialized value $_ in pattern match." Over my head for sure.

Replies are listed 'Best First'.
Re^3: Remove whitespace between lines
by poj (Abbot) on Feb 03, 2015 at 18:51 UTC
    Try
    while (my $line = <$fh_in>) { print $fh_out $line if ($line !~ /^\s*$/); }
    poj
      That's it, works great! Appreciate your interest and patience! :-)
        A more normal way to do this is to skip the blank lines and then process those lines further.
        while (my $line = <$fh_in>) { next if ($line ~ m/^\s*$/); #skip blank lines #more processing of this non-blank line }