Philip Morley wrote:
>
> Is there a better way of getting the first line from a file than this, if
> so how:
>
> open (FILE, "somefile.txt");
> my $Counter = 1;
> while ()
> {
> chomp;
> if ($Counter == 1)
> {
> $Line1 = $_;
> }
&
TECTED]
Cc: Philip Morley
Subject: RE: Getting the first line from a file
open (FILE, "somefile.txt");
while ()
{
chomp;
$Line1 = $_;
last;
}
close (FILE);
-Original Message-
From: Philip Morley [mailto:PMorley@;edisonmission.com]
Sent: Monday, November 11, 2002 7:35 AM
open (FILE, "somefile.txt");
while ()
{
chomp;
$Line1 = $_;
last;
}
close (FILE);
-Original Message-
From: Philip Morley [mailto:PMorley@;edisonmission.com]
Sent: Monday, November 11, 2002 7:35 AM
To: [EMAIL PROTECTED]
Subject: Getting the first line from a file
Is there a better way of getting the first line from a file than this, if
so how:
open (FILE, "somefile.txt");
my $Counter = 1;
while ()
{
chomp;
if ($Counter == 1)
{
$Line1 = $_;
}
$Counter++;
}
This method will read the entire file, which is unnecessary since I onl