OPEN(FILE, "<$g_all_sleepy) or die "Couldn't open the file"; @lines = <FILE>; CLOSE(FILE); Chomp @lines; $variable = $lines[0];
Scott Ryan OneTel.Net ISP Engineer [EMAIL PROTECTED] 02073319370 -----Original Message----- From: Yacketta, Ronald [mailto:[EMAIL PROTECTED]] Sent: 08 January 2002 16:06 To: [EMAIL PROTECTED]; Yacketta, Ronald Cc: Beginners (E-mail) Subject: RE: pull line #1 from a file so so close... I had this OPEN(FILE, "< $g_all_sleepy); @lines = <FILE>; CLOSE(FILE); $lines[0]; # think this is right, its an array.. all arrays start at 0 not 1.. unless # perl is funky and dont ;) > -----Original Message----- > From: Casey West [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 08, 2002 10:56 > To: Yacketta, Ronald > Cc: Beginners (E-mail) > Subject: Re: pull line #1 from a file > > > On Tue, Jan 08, 2002 at 10:50:51AM -0500, Yacketta, Ronald wrote: > : > :Folks, > : > :need some minor help here.. been looking in the Cookbook for > an example > :to pull the first line from a file.. > > open FILE, "filename" or die $!; > my $line = <FILE>; > close FILE; > > Remember, <FILEHANDLE> is something you can iterate over. In scalar > context it returns just one line (for all intents and purposes) at a > time. > > Casey West > > -- > Usenet is like Tetris for people who still remember how to read. > -- Button from the Computer Museum, Boston, MA > -- 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]