On Mon, Nov 28, 2016 at 08:53:34AM +0000, Dave Mitchell wrote: > On Mon, Nov 28, 2016 at 08:14:23PM +1300, Kent Fredric wrote: > > At parse time, the Perl compiler parsing the for { } block *lexically* > > parses for a variable ( we'll just say $# for now ). > > > > And then upon detecting that variable's usage in its block, then instruments > > the for loop to behave differently. > > what about: > > for (...) { > eval '$#'; > } Another approach would be to extend the for syntax, e.g. for -> $i (....) { say "$i: $_" } for $x -> my $i (....) { say "$i: $x" } for my $x -> my $i (....) { say "$i: $x" } for a suitable bikeshedding of '->'. -- Indomitable in retreat, invincible in advance, insufferable in victory -- Churchill on MontgomeryThread Previous | Thread Next