pairkeys#

Extract just the keys from an even-sized key/value list.

Synopsis#

my @keys = pairkeys @kvlist;
my @keys = pairkeys %hash;

What you get back#

A list of every even-indexed element (indices 0, 2, 4, …). Equivalent to but more efficient than

pairmap { $a } @kvlist

Examples#

my @k = pairkeys one => 1, two => 2;   # ('one', 'two')
my @k = pairkeys %ENV;                 # names of every env var

Differences from upstream#

Fully compatible with upstream.

See also#

  • pairvalues — the value-side counterpart.

  • pairs — keep keys and values bound together.