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