Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: keys with an expression

by lune (Pilgrim)
on Nov 20, 2013 at 15:04 UTC ( #1063540=note: print w/replies, xml ) Need Help??


in reply to keys with an expression

I don't know if that worked before, but I do find the error message okay, as
(map { $_ => 1 } @array)
returns a list, not an array, which "keys" would also accept as a valid argument.

You get the same error if you try:

my @unique = keys (1,1,2,3,2,2);

but not with:
my @unique = keys @array;
which returns the indices of the array.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2022-05-21 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (78 votes). Check out past polls.

    Notices?