Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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??

Help for this page

Select Code to Download


  1. or download this
    use List::Util qw( uniq );
    
  2. or download this
    sub uniq {
        my @values = @_;
    ...
        @uniq{@values} = ();
        return keys %uniq
    }
    
  3. or download this
    sub uniq {
        my @values = @_;
        my %seen;
        return grep ! $seen{$_}++, @values
    }
    

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 chanting in the Monastery: (6)
As of 2021-06-14 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (62 votes). Check out past polls.

    Notices?