Chas Owens wrote:
On 5/7/07, Robert Hicks <[EMAIL PROTECTED]> wrote:
I have one file that contains a log. I do a substr to get the
information out of that and push it into an array.

I have a second file that contain another log. I need to loop through
the items in the array and find them in this log. Once I find the line
that the id is on, I need the next line /^AMP-commit/ captured.

I am getting:

"Use of uninitialized value in pattern match (m//) at ./amp_parse.pl
line 39, <$AFILE> line 213622."
snip

It sounds like your substr is returning undef at some point in the
first file.  If this is not an error then try changing the loop to


I think part of the problem is the 'shift'ing that I was doing. I am looking into that. Basically I was shift'ing the @log out of existence after the first pass.

Basically 1 id will create 2 lines; line 1 of the log for a particular id is the "what" and line 2 is the "why". I am trying to get at the 2nd line.

while (defined(my $ifile_line = <$IFILE>)) {
   my $hits = substr($ifile_line, 0, 6);
   next unless defined $hits;
   push @id_hits, $hits;
}

Also, you should never use a straight string in a regex; it should
aways be quoted.

$line = shift @log until $line =~ /\Q$prime_id\E/;

What does that give you? I have never heard of that and have never had a problem the way I have shown. Just curious...

Robert

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to