undef $/; open(FIN,"d:\\temp.txt"); $str=; close($str); while($str =~m#Title: (.*?) invalid#gi) { push(@arr,$1); } print "$_\n" for @arr;