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

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Is there an easier way to determine the length of a data file. The file I'm reading in has blank lines, that I DON'T want in my array.

This is my current code:

while(<DATA>){ # Populate the data array if ($_ ne ""){ push @data, $_; } } close DATA; my $length = @data; print "LENGTH: $length\n";
My check for NULL doesn't seem to work....
Any suggestions?