in reply to Re^3: Pattern matching regex problem
in thread Pattern matching regex problem

Or, if you don't care about tr///:

if ($s =~ /M/) { print "case1\n"; } else { print "case2\n"; }

Replies are listed 'Best First'.
Re^5: Pattern matching regex problem
by ikegami (Patriarch) on Nov 23, 2021 at 21:00 UTC

    tr should be faster, though.