On Mon, Sep 09, 2002 at 02:29:24PM -0700, RTO RTO wrote:
> $_ variable points to list in the outer-loop or
> inner-loop depending upon the scope. I prefer to not
> use aliases. In such a case, when I am in the scope of
> inner loop, can I access the looping variable on the
> outer without using an explicit alias variable?
No. You have effectively hidden the previous value of $_ in the inner loop,
and there is no way currently of getting to it again.
By alias I assume you mean a named iterator, i.e.:
foreach my $foo (0 .. 4) {
...
}
where $foo is what you're calling an alias. You'll have to use a named
iterator for one of the loops.
Out of curiousity, why do you prefer not to use a named iterator? They're
often more readable than the ever-implicit $_, especially if you end up
referring to the variable explicitly in the block.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]