[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Concernant:Re: [MacPerl] Counting the number of lines in a document



At 15:12 26/04/96, Jim Flanagan wrote:

>   Even lighter weight is:
>
>     while (<>) {}
>
>   After which the variable $. will contain the value you seek.

Hello,

Is it possible to read a particular line number from a file? If you
already know which line contains the value you are looking for it must be
faster to return directly that line instead of cycling through the file
until there's a match.

How can I implement something like '$myline = line 8 of MYFILE' in proper perl?

I'd like to avoid loading the whole file into an array since the file I am
using can be very large.

Thanks for any help.
Stˇphane

                ___S__t__e__p__h__a__n__e______J__o__s__e___
                            jose.stephane@uqam.ca
                    http://www.er.uqam.ca/nobel/m206474/