From: "Jim" <[EMAIL PROTECTED]>
> > > ----Original Message----- > > From: Umesh T G [mailto:[EMAIL PROTECTED] > > > > Sent: Friday, July 29, 2005 3:47 PM > > To: beginners@perl.org > > Subject: Read a single line in a file. > > > > > > Hello List, > > > > I have a file with multiple lines. I want to read only the first line. > > > > and a particular word in that line. > > > > > > For eg: > > > > File.txt > > > > apple,grape,orange,banana > > some other lines > > continued. > > > > So I want only the word grape here. How to get it? > > > Hi, Use the script below: open(FILE, $file_name); my ($first, $second, $third, $fourth) = split /,/, <FILE>; close FILE; print $third; Teddy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>