in reply to Removing white-lines...
# open the input and output files open( my $in_fh, '<' ... open( my $out_fh, '>' ... # operate on a single line at a time rather than reading the # input file in all at once (more memory-efficient if the # input file is very large) while( my $line = <$in_fh> ) { # skip the line if it contains only white space, # otherwise print it to the output file next if $line =~ m/^\s*$/; print $out_fh $line; } close $in_fh; close $out_fh;
|
|---|