Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Perl Idioms Explained - keys %{{map{$_=>1}@list}}

by broquaint (Abbot)
on Aug 04, 2003 at 12:55 UTC ( #280658=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @list = qw/a b c d d a e b a b d e f/;
    my @uniq = keys %{{ map {$_ => 1} @list }};
    ...
    
    a b c d d a e b a b d e f
    e f a b c d
    
  2. or download this
    map { $_ => 1 } @list
    
  3. or download this
    { map { $_ => 1 } @list }
    
  4. or download this
    keys %{ { map { $_ => 1 } @list } }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://280658]
Approved by adrianh
Front-paged by Courage
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2018-11-15 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (183 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!