print "mf" if grep { $line =~ $_ } @patterns; #### foreach my $pattern (@patterns) { print "Match found\n" if $line =~ $pattern; }