while ($line ne ""){ chomp($line); #### while ( $line = ) { chomp $line; next if $line eq ""; #...... do your stuff here } # end of while loop.