I still like eval "\$one =~ tr/\Q$two\E//cd" as part of a solution. But there is also this:
sub CommonChars { my $comm = shift @_; $comm =~ s/[^\Q$_\E]//g for @_; my %seen; return grep !$seen{$_}++, $comm =~ /(.)/gs; }
Which works for any number of strings.
- tye
In reply to Re: Unique List of Common Characters Between Two Strings (s///)
by tye
in thread Unique List of Common Characters Between Two Strings
by Limbic~Region
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |