in reply to Re: Why does 'keys' need a named hash?
in thread Why does ‘keys’ need a named hash?
I just noticed there are functions for this in List::Util: pairkeys and pairvalues. For example:
use v5.14; use List::Util qw(pairkeys pairvalues); my @a = qw(a b c d e f); say "keys = ", join ", ", pairkeys @a; say "values = ", join ", ", pairvalues @a; my %h = @a; say "keys = ", join ", ", keys %h; say "values = ", join ", ", values %h;
The obvious difference to keys and values of a hash is that pairkeys doesn't remove duplicates and it keeps the original array order.
In Section Seekers of Perl Wisdom