in reply to Re: Re: Re: number of lists in array
in thread number of lists in array

Or, probably faster, and with the benefit of having the file read into memory:
my ( $count, @data ); open (FH, "myfile.txt") or die $!; $count = scalar (@data = <FH>); close FH;

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: number of lists in array
by CharlesClarkson (Curate) on Dec 01, 2001 at 08:03 UTC

    I doubt it's efficient but this just looks too wierd not to mention.

    my $lines = do{ my $file_name = 'in.txt'; open my $fh, $file_name or die "$file_name: $!"; () = <$fh>; }; print $lines;



    HTH,
    Charles K. Clarkson