foreach $reqidline () { print "reqid - $reqidline\n"; $reqidline =~ s/ */|/g; # Replace multiple spaces with pipe characters @reqidLineElements = split(/\|/,$reqidline); # Split line elements into an array $count = 0 ; print "\tactual reqid - $reqidLineElements[0]\n"; foreach $inline () { print "\tinline - $inline\n"; $reqidLineElement = $reqidLineElements[0] ; print "\textracted reqid - $reqidLineElement\n"; # if ($inline=~m/$reqidLineElement/) if (834531 == $reqidLineElement) { # Write the line from the log to output $count = 0 ; next ; print "\tMATCHED - $inline\n"; } if ( ($inline =~ /$reqidLineElements[0]/ ) and ( $inline =~ /SELECT/) ) { # Write current line to output print "\tSELECT - $inline\n"; # Initiate the reading of the next 3 lines from the log $counting = "true" ; $count = 0 ; next ; } if ( $counting eq "true" )