#!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";