Front page | perl.beginners |
Postings from February 2002
Looping Code ?
Thread Next
From:
gkhgkh
Date:
February 27, 2002 13:14
Subject:
Looping Code ?
Message ID:
20020227211429.ZTQT1214.rwcrmhc54.attbi.com@rwcrwbc55
What I am trying to do is get a total of line that
matches a specific criteria and when it stops matching
return the total to variable. If I have the following
files:
file1: file2:
$line[1] = $field[0]
AR AR
AR ACCT
AR
ACCT
ACCT
ACCT
ACCT
and use the following:
if ($line[1] = (/^:$field[0]/)) {
$total = $count++;}
I want $total for AR to = 3 and $total for ACCT = 4.
When I run it I get
1
2
3
3
3
3
3
1
2
3
4
4
4
4
4
4 etc...
Any thoughts
Thanks
Thread Next