ezekieldas has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to see:@stuff = (a, 1, b, 2, c, 3, d, 3);
The closest I can get to this is...c => 3 d => 3
@stuff = (a, 1, b, 2, c, 3, d, 3); push(@unique, foo, grep { $seen{$_}++ } @stuff); %unique = @unique; while ( ($key, $value) = each %unique) { print "$key => $value\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: show me key, value when values are duplicate
by jwkrahn (Abbot) on Oct 05, 2011 at 22:51 UTC | |
|
Re: show me key, value when values are duplicate
by aaron_baugher (Curate) on Oct 06, 2011 at 01:36 UTC | |
by aaron_baugher (Curate) on Oct 06, 2011 at 11:16 UTC |