while () { chomp; if($_ =~ /matchingStuffHere/) { for(my i=0;i<9;i++) { print $_[2]; #just want the 3rd index } } }