Hello Charles,
At 12:22 PM 10/31/2002 -0500, [EMAIL PROTECTED] wrote:
>
>I have a file that looks like
>0
>232,32387,2323
>
>I am only interested in the last set of digits on the second line. My plan
>was to split on coma and take the 3 element of the array. I am having
>problems skipping the fi
Maybe I'm reading this wrong, but if you're only looking for the third field
on the second line, why not just do this:
open(INFILE,"myfile.txt") || die "Could not open myfile.txt! $!";
; #skip the first line
$_ = ;
my $thirdField = (split /,/,$_)[2]; #Get the third elementof
Charles Belcher wrote:
>
> I have a file that looks like
> 0
> 232,32387,2323
>
> I am only interested in the last set of digits on the second line. My plan
> was to split on coma and take the 3 element of the array. I am having problems
> skipping the fist line. Any assistance would be appreci
open(FH,"your_file.txt") || die $!;
my @tmp = readline(*FH); #this will read each line in your file
my @second_row = split(/,/,join('',$tmp[1]),"\n"); #just look at the
second row
print($second_row[2]); #third element in array
close(FH);
-Original Message-
From: [EMAI
s
> Sent: Thursday, October 31, 2002 12:32 PM
> To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
> Subject: RE: skip the first line
>
>
>
> open (F, "$file") or die "can't open $!\n";
> while ($line = ) {
> next if $. == 0; # first line i
open (F, "$file") or die "can't open $!\n";
while ($line = ) {
next if $. == 0; # first line is skipped
# do stuff with next line
}
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:Charles.Belcher@;mercantile.net]
> Sent: Thursday, October 31, 2002 12:22 PM
> To: