in reply to Find duplicate chars in a string
sub has_dup_letters { local $_ = shift; tr/a-zA-Z//cd; tr/A-Z/a-z/; my %dups; scalar grep $dups{$_}++ for split //; }
-- Randal L. Schwartz, Perl hacker
withscalar grep $dups{$_}++ for split //;
I've been in "postfix for" mode for some reason.scalar grep $dups{$_}++, split //;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Find duplicate chars in a string
by CheeseLord (Deacon) on Oct 14, 2001 at 09:01 UTC | |
by merlyn (Sage) on Oct 14, 2001 at 19:10 UTC | |
|
Re: Re: Find duplicate chars in a string
by Fletch (Bishop) on Oct 14, 2001 at 18:35 UTC |