Hi,
Is it possible to read a particular line by line number ?
For e.g reading line 3 from a file.
I don't want to read each line and count.
Thanks
Alok
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Wed, 2007-06-20 at 17:12 +0530, Nath, Alok (STSD) wrote:
> Hi,
> Is it possible to read a particular line by line number ?
>
> For e.g reading line 3 from a file.
>
> I don't want to read each line and count.
No and yes. If it is genuine new random data then no.
If it is fi
On Jun 20, 7:42 am, [EMAIL PROTECTED] (Alok Nath) wrote:
> Is it possible to read a particular line by line number ?
>
> For e.g reading line 3 from a file.
>
> I don't want to read each line and count.
You don't have to count. Perl counts for you. The current line number
On 20 Jun, 16:42, [EMAIL PROTECTED] (Alok Nath) wrote:
> Hi,
> Is it possible to read a particular line by line number ?
>
> For e.g reading line 3 from a file.
>
> I don't want to read each line and count.
>
> Thanks
> Alok
You can do below to print the 3rd line.
open FIL
But that still reads the entire file to that point,
You can use seek if you know the number of chars on a line.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 20 June 2007 13:53
To: beginners@perl.org
Subject: Re: Reading a particular line from a file
On 20
On 06/20/2007 06:42 AM, Nath, Alok (STSD) wrote:
Hi,
Is it possible to read a particular line by line number ?
For e.g reading line 3 from a file.
I don't want to read each line and count.
Thanks
Alok
The module Tie::File makes this easy. However, you should probably