in reply to Re: Re: for, foreach and $_...
in thread for, foreach and $_...

...Is there another system like $1, $2... ?

Not in Perl 5. $_ always refers to the innermost loop. You will have to name the outer one specifically if you want to access it from the inner one.

foreach my $outer (@array) { foreach (@otherarray) { } }

I've been lead to understand that you will be able to access topics (Perl 6 speak for $_) "above" your current scope in Perl 6, but it will be considered bad programming practice to actually use it. It will be more for debugging tools that e.g. will allow you to show what the current topic is while you're stepping through the code.

That's what I remember of various Perl 6 talks and reading about it... Of course, it may have all be changed again by now... ;-)

Liz

Replies are listed 'Best First'.
Re: Re: Re: Re: for, foreach and $_...
by chromatic (Archbishop) on Aug 18, 2003 at 16:45 UTC

    It will be as bad as using pronouns in normal speech. (You can get away with that if you do it reasonably well.)