in reply to Re^2: Access a global variable from a subroutine when used as "for" iterator
in thread Access a global variable from a subroutine when used as "for" iterator

Closures are not generally smelly, but global variables almost always are. My impression is the OP was aiming for a global variable rather than a closure. Very likely if a closure is intended by an OP the fact is mentioned because that has a strong influence on the expected behavior of the code. No mention, no closure.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
  • Comment on Re^3: Access a global variable from a subroutine when used as "for" iterator

Replies are listed 'Best First'.
Re^4: Access a global variable from a subroutine when used as "for" iterator
by vitoco (Hermit) on Dec 21, 2023 at 04:49 UTC

    It was just to simplify the maintenance of a special portion of the code at the expense of supporting functions/methods. The full story is here.