Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Using 'keys' on a list

by ikegami (Patriarch)
on Jun 29, 2021 at 20:03 UTC ( [id://11134463]=note: print w/replies, xml ) Need Help??


in reply to Using 'keys' on a list

The issue is that keys requires a hash (or an array), but you are (attempting to) provide it a bunch of scalars.

But while keys doesn't help, working with such data is exactly the purpose of the pair* functions in core module List::Util.

say for pairkeys f;

You could also use grep, but it's a bit inelegant.

sub pairkeys { my $i = 0; grep { $i ^= 1 } @_ }

Seeking work! You can reach me at ikegami@adaelis.com

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-16 05:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found