On Tue, Feb 26, 2002 at 02:20:48PM -0800, Brent Dax wrote: > Austin Hastings: > # > # Which, then, would you like: > # > # To implicitly localize $_, losing access to an outer version, > # or to have to change between implicit and explicit operations?
Well, I like the idea of having C<when> and the C<s///> operate on the same thing. But I don't really want C<when> to either localize or clobber $_, I want it to leave the information structure alone. That's why I'd alias $_ at the C<given> or the C<for>, just like I would now. > # > given $y { > # > when /a/ {...} > # > when /b/ {...} > # > ... > # > } > > That's easy to fix in one of two ways: > > for @A -> $y { > for @B -> $x { $y =~ s/x/y/; $x =~ s/x/y/; > ... > } > } Which gives you no defaults, but the ultimate in clarity and control. > # for @A { > # for @B -> $x { > # when /a/ { s/x/y/; } s/x/y/; > # } > # } > # > # What should that do? Even if we give C<when> aliasing powers, it is still confusing, because you jump back and forth between the $_ within the C<when> block and the $_ between C<when> blocks. Allison