http://www.perlmonks.org?node_id=141167


in reply to Re: Re: hm strange loop for me..
in thread hm strange loop for me..

It's easy enough to check for a blank record:

$/ = "\n//\n"; # Or whatever is appropriate. while (<>) { chomp; # Removes the field separator. next if /^\s*$/; # Skip "space-only" records. # Do stuff here. }

This means if there's a blank record at the end (or in the middle, for that matter) it will get skipped instead of processed.

Cheers,

Paul Fenwick
Perl Training Australia