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.
Any suggestions?
This is my current code:
My check for NULL doesn't seem to work....while(<DATA>){ # Populate the data array if ($_ ne ""){ push @data, $_; } } close DATA; my $length = @data; print "LENGTH: $length\n";
Any suggestions?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: File length ??
by Aristotle (Chancellor) on Sep 12, 2002 at 18:36 UTC | |
Re: File length ??
by Moonie (Friar) on Sep 12, 2002 at 18:36 UTC | |
Re: File length ??
by dws (Chancellor) on Sep 12, 2002 at 18:50 UTC | |
Re: File length ??
by charnos (Friar) on Sep 12, 2002 at 20:00 UTC | |
Re: File length ??
by thor (Priest) on Sep 13, 2002 at 00:06 UTC |
Back to
Seekers of Perl Wisdom