in reply to Re: What about if (my $var = foo()) { ... }
in thread What about if (my $var = foo()) { ... }
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: What about if (my $var = foo()) { ... }
by dsheroh (Monsignor) on Dec 29, 2007 at 16:39 UTC | |
by Limbic~Region (Chancellor) on Dec 29, 2007 at 16:49 UTC | |
by dsheroh (Monsignor) on Dec 29, 2007 at 18:46 UTC |