http://qs321.pair.com?node_id=197329


in reply to File length ??

Are you trying to determine the number of lines in the data file after taking out blank lines? Also, what's blank? Does blank include spaces? My suggestion would be as such:
@data = grep { $_ !~ /^\s*$/ } @a; my $length = scalar @data;
That is assuming that blank lines may or may not include spaces. If you know that they will not, you could save yourself a good deal of time (especially for large files) by simply testing $_ ne "" in the grep.