Um... that code doesn't compile, nor does it do the same thing as the original code. This is my version (it could use whatever error checking you might want on the user-supplied alphabet, though):
sub has_dup_letters { local $_ = lc shift; my $alpha = @_ ? shift : 'a-z'; eval "tr/$alpha//cd"; my (%dups, $total); $dups{$_}++ and $total++ for split //; return $total; }
His Royal Cheeziness
In reply to Re: Re: Find duplicate chars in a string
by CheeseLord
in thread Find duplicate chars in a string
by monkfish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |