#!C:\Perl\bin\perl.exe -w use strict; # I'm a masochist my $file = shift || 'foo.txt'; # why not my @lines; open(SESAME, $file) || die "Cannot open $file: $!"; # save debugging time while () { chomp; next unless $_; push @lines, $_; } close(SESAME) || die "Cannot close $file: $!"; my $total = @lines; print "There are $total records in $file\n"; #### { local *SESAME; # localizing a filehandle saves debugging time too open (SESAME, $file) || die "Foo: $!"; local $/ = "\n\n"; # "line" delimiter is now two newlines @lines = ; close (SESAME) || die "Bar: $!"; }