in reply to Re^4: Playing with non-localized $_ in nested loops.
in thread Playing with non-localized $_ in nested loops.

The aliasing is local to the scope of these constructs, so why is it confusing things to say that the constructs localize $_?
  • Comment on Re^5: Playing with non-localized $_ in nested loops.

Replies are listed 'Best First'.
Re^6: Playing with non-localized $_ in nested loops.
by Aristotle (Chancellor) on Aug 23, 2004 at 15:44 UTC

    Because it isn't localizing, which creates an entirely isolated new thing for $_ to refer to. It's binding, in which $_ takes on the role of another scalar. The results of modifying $_ inside an aliasing construct persist past that construct, even if not in $_. When you localize it, the result is forever lost after the block. local creates an isolated reality; the aliasing constructs do not.

    Makeshifts last the longest.

      Ah, that's a good explanation. Thanks!