$_ = "abcdmefg"; if ($_ =~ /m/g) { print "matched 'm' at ",pos,"\n"; } #### $_ = "abcdmefg"; if (($pos = index($_, 'm')) >= 0) { print "found 'm' at ", $pos, "\n"; }