in reply to Re^2: Pattern matching regex problem
in thread Pattern matching regex problem
If all you want to do is check the presence of M using tr/// then it is simple:
#!/usr/bin/env perl use strict; use warnings; my $s='IIIIIIIIIIIIIIIIIIIIIIIIIIOOOOOSSSSS'; print "$s: " . ($s =~ tr/M/M/ ? "case1\n" : "case2\n"); $s .= 'M'; print "$s: " . ($s =~ tr/M/M/ ? "case1\n" : "case2\n");
🦛
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Pattern matching regex problem
by bibliophile (Prior) on Nov 23, 2021 at 15:00 UTC | |
by ikegami (Patriarch) on Nov 23, 2021 at 21:00 UTC | |
Re^4: Pattern matching regex problem
by ikegami (Patriarch) on Nov 23, 2021 at 21:00 UTC | |
by eyepopslikeamosquito (Archbishop) on Nov 24, 2021 at 10:45 UTC |
In Section
Seekers of Perl Wisdom