for ($num=0; $num<=100; num++){ if (@text[$num] contains 'string'){ $cnt++; } } print "string was found on $cnt lines"