Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Why does ‘keys’ need a named hash?

by ankitpati (Sexton)
on Apr 05, 2017 at 11:55 UTC ( #1187094=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
            sub uniq {
                my %hash = map { $_ => 1 } @_;
                return keys %hash;
            }
    
  2. or download this
            sub uniq {
                return keys map { $_ => 1 } @_;
            }
    
  3. or download this
            sub uniq {
                # two pairs of braces around map
                return keys %{ { map { $_ => 1 } @_ } };
            }
    
  4. or download this
            sub uniq {
                # single pair of braces around map
                return keys %{ map { $_ => 1 } @_ };
            }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1187094]
Approved by 1nickt
Front-paged by 1nickt
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2022-01-26 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (70 votes). Check out past polls.

    Notices?