http://www.perlmonks.org?node_id=833952


in reply to a sub within a sub -- revisiting

Good code is usually straight forward, and this code is misleading in couple of ways:

  1. Visually, bar seems to be only available inside foo. But that's not true, bar can actually be called outside of foo.
  2. Make it even worse, when bar is called outside of foo, it does not do what's expected any more.

Peter (Guo) Pei