I have 2 files. One is an error log created from an import procedure to a
database, the other is the text file that we were trying to import. The
error log gives me back the line number that the record was on. I need to
cross reference this. I'm thinking that this should be no big deal. I'll
read one file, parse it, and add the record/line # to an array. Then, I'll
loop through the other file, and when I get to a line that matches one in
the array, I'll write the value to a text file. The problem is that I
can't get assign any values to my array.
Why won't the following work?
my @records="";
$llc = 1; ### Set the log line count = 1;
while(<LOG>){ ### Go through that log file line by line.
if($llc<10){ ### We're going to skip the first 10 lines here. (Header Info)
}else{
if($_ =~ /Record#/){ ### Make sure that we're looking for the errors
that we want to see.
@line = split; ### We're gonna split the
line.
@records = (@records,$line[1]); ### Add the second part
of this line to @records
print "Adding $records[0] to the record list.\n"; ### Just a little
diagnostic tool.
} ### Close the if on line 20.
} ### Close the if block on line 18 (else on line 19)
$llc = $llc + 1; ### Increment the line number.
} ### Close that while block up on 17.
close(LOG); ### Close the log file and free up some resources.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- Re: Question about assigning a value to an array. Aaron Petry
- Re: Question about assigning a value to an array. Jeff 'japhy' Pinyan