for ($x=0;$x<=$#lines;$x++) # Three arguments are treated differently than using # the for loop with the list argument { if($lines[$x]=~/request/) { (undef, $blah1) = split /\(/, $lines[$x]; if($blah1!~/BADSTRING/) { (undef, $blah2)=split /,/, $lines[$x+1];, print "$blah1:$blah2\n"; $x++; #<--------Increment to skip the next line } } }