$count[$i]++ and last if /$patterns[$i]/;