Perl 6 Perl 6 today #25

Iterating n values at a time

We can also have multiple placeholder variables in a block

my %scores = < pmichaud 52   mäsak 95   PerlJam 78 >;

# pointy block version
for %scores.kv -> $name, $score {
    say "$name has $score points";
}

# placeholder version
for %scores.kv {
    say "$^name has $^score points";
}

When multiple placeholder variables are present, they are ordered lexicographically by name

Copyright © 2009
http://www.pmichaud.com/2009/pres/