while (my $line = <$fh_in>) { print $fh_out $line if $line !~ /^\s*$/; }