never mind, i found it.

-----Original Message-----
From: Rowe, Sean D. [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 27, 2002 8:40 AM
To: Janek Schleicher; [EMAIL PROTECTED]
Subject: RE: Faster way to go to a line in a file


Where can I find the Tie module on cpan?  I'm not sure where to look for.
My perl distribution doesn't have it loaded, and my system administrator is
gone.

Sean

-----Original Message-----
From: Janek Schleicher [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 27, 2002 6:41 AM
To: [EMAIL PROTECTED]
Subject: Re: Faster way to go to a line in a file


Sean D. Rowe wrote at Thu, 26 Sep 2002 20:54:49 +0200:

> Right now, to get to a certain line number, I will open the file, set a
for
> loop to get a line until line number is reached, and then quit.  Is there
a
> faster way?
> 
> ex:   for (my $i = 1; $i <= $LineNumber; $i++)
>       {
>               $Line = $FileHandle->getline;
>       }

I don't know whether there's a faster way,
but there's simpler way:

use Tie::File;
tie my @line, 'Tie::File', $fname;
my $nth_line = $line[$n];


Greetings,
Janek

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to