http://qs321.pair.com?node_id=11139045


in reply to Pattern matching regex problem

tr doesn't take character classes in square brackets ([]), so your code can also be written as:

if (0 == $s =~ tr/IOSM//c) {

Your code counts whether there is any of the letters I, O, S or M in the string. Which is obviously true.

Maybe you wanted to match the letters in order?

m/I+O+S+M+/