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 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 FILE, "./xyz" or die "can not open file xyz"; while (<FILE>) { print if ($.==3) } Deepak -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ This e-mail is from the PA Group. For more information, see www.thepagroup.com. This e-mail may contain confidential information. Only the addressee is permitted to read, copy, distribute or otherwise use this email or any attachments. If you have received it in error, please contact the sender immediately. Any opinion expressed in this e-mail is personal to the sender and may not reflect the opinion of the PA Group. Any e-mail reply to this address may be subject to interception or monitoring for operational reasons or for lawful business practices. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/