# Create a file array of lines while ($line = ){ push (@array, $line); } #### my @array = ; #### # Then control the output foreach $index (@array){ # if the line is completely blank dont print it. if ($index !~ /^\s*\n\s*$/) { print "$index"; } } #### for (@array) { print unless /^(\n|\s+)$/; }