In perl 5, we write:
The $name lexical is implicitly scoped to the for block. This is not the case in perl 6. The way perl 6 solves this is by introducing parameters to the block so you achieve the same thing in a cleaner way (from a design perspective).for my $name (keys %people) { # do something with $name }
Cheers - L~R
In reply to Re^2: What about if (my $var = foo()) { ... }
by Limbic~Region
in thread What about if (my $var = foo()) { ... }
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |