in reply to I don't understand why I'm getting an unitialized value warning
Here's how I'd make sure there are no blank records in the file,
to get an accurate count of the records that have data in them:
(I've been doing a lot with regular expressions and file parsing lately)
local $/; # Perl's record separator - default is \n unless...
$/ = undef; # ... we make it undefined!
open(SESAME,$file) # open the file
$f = (<SESAME>); # the entire file, including all \n chars, is now sitting in a single scalar!
close(SESAME);
$f = s/\n+/\n/gs; # regular expression replaces contiguous strings of \n chars with single \n chars.
$f = s/^\n//s; # removes \n at the start of the string, if there is one.
$f = s/\n$//s; # removes \n at the end of the string, if there is one.
@x = split(/\n/, $f); # split string on the \n char, store split values in array @x
$x = @x; # the number of elements in @x
print "There are $x records in file $file\n";
exit(0);