Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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?
[usemodperl]: this is crazy, the web is broken!
[usemodperl]: just because of banking apps on free wifi, and porn, i guess...
usemodperl thinks every1 should serve HTTP on port 80 incase we don't care about encryption, right? wtf

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2018-06-24 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?