sub no_dups { my $in = join( '', sort split '', shift ); ( my $out = $in ) =~ y/smtwhfa/smtwhfa/s; $out =~ y/smtwhfa//cd; print "no dupes $in\n" if length $in == length $out; } no_dups( 'afhwtms' ); no_dups( 'smtthfa' ); no_dups( 'smatwhfa' ); no_dups( 'afhwtmsz' );
Update: Ooop, didn't consider characters not in the allowed alphabet. Added second y/// to correct.
In reply to Re: Regex (lookahead) Confusion
by Fletch
in thread Regex (lookahead) Confusion
by ChrisR
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |