#!/usr/bin/perl my $string = "Helloa, this is the string"; my @chars = qw(s,o,m,e,c,h,a,r,s); if ( grep $string =~ /$_/, @chars ) { print "OK"; } else { print "Oops"; } #### foreach (@chars) { if ($string =~ /$_/) { $anymatches++ } } if ($anymatches) { print "OK" } else { print "Oops" }