Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: extracting only those keys with uniq values in array list

by choroba (Archbishop)
on Apr 19, 2021 at 23:14 UTC ( #11131486=note: print w/replies, xml ) Need Help??


in reply to extracting only those keys with uniq values in array list

List::Util is core and also exports uniq.
use List::Util qw( uniq );

Or, write your own:

sub uniq { my @values = @_; my %uniq; @uniq{@values} = (); return keys %uniq }

or, if you want to keep the order:

sub uniq { my @values = @_; my %seen; return grep ! $seen{$_}++, @values }

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11131486]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (None)
    As of 2021-05-10 01:19 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Perl 7 will be out ...





      Results (103 votes). Check out past polls.

      Notices?