Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Why does 'keys' need a named hash?

by pme (Prior)
on Apr 05, 2017 at 12:12 UTC ( #1187098=note: print w/replies, xml ) Need Help??


in reply to Why does ‘keys’ need a named hash?

Hi ankitpati,

map { $_ => 1 } @_
returns list having even number of elements. 'keys' works only on hashes. In your working example %hash is initialized with the list returned by 'map' and then 'keys' can do the job on %hash.

HTH

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2019-11-22 02:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (107 votes). Check out past polls.

    Notices?