in reply to slurping into a substring'ed' array
See. Perl Idioms Explained - keys %{{map{$_=>1}@list}} for an explanation of the above technique for simply getting a unique list.my @ids = qw/ A1 A2 A3 B5 B6 B7 C789 C790 /; my @letters = sort keys %{ { map { substr($_,0,1), undef } @ids } }; print "Found the following letters: @letters\n"; __output__ Found the following letters: A B C
_________
broquaint
update: fixed bug as noted below by davido
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: slurping into a substring'ed' array
by davido (Cardinal) on Apr 26, 2004 at 15:21 UTC |