in reply to Using 'keys' on a list

You can use pairkeys from List::Util, i.e. say for pairkeys f; works fine. You'll need List::Util 1.29 for this function, which is part of the Perl core since 5.20, or you can get it from CPAN.

Update: tybalt89 makes a good point that pairkeys may return duplicate "keys", unlike keys.