last if $line=~/^$/; # or using length.. #### while ( chomp ( $_ = ) and length $_){ print " [$_]\n"; }