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

Don't be too quick to knock your approach. I find it useful in "real" programs to use a named variable to indicate to my reader (me in most cases :) what I expect that variable to represent. This is especially useful in nested constructs where $_'s semantics change as construct boundaries are crossed.

And if I change a foreach (...) to a while (...), the magic of $_ disappears, and I might introduce bugs similar to gaal's example.

Sometimes using explicit variables helps you find logic errors too.

-QM
--
Quantum Mechanics: The dreams stuff is made of