pairvalues#

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

תקציר#

my @values = pairvalues @kvlist;
my @values = pairvalues %hash;

מה מוחזר#

A list of every odd-indexed element (indices 1, 3, 5, …). If the input has an orphan key at the end, its corresponding value is undef. Equivalent to but more efficient than

pairmap { $b } @kvlist

דוגמאות#

my @v = pairvalues one => 1, two => 2;   # (1, 2)
my @v = pairvalues %ENV;                 # values of every env var

הבדלים מן ה-upstream#

Fully compatible with upstream.

ראו גם#

  • pairkeys - the key-side counterpart.

  • pairs - keep keys and values bound together.