The majority of the problems can indeed be solved that
way. (Though good luck if you forget a local
But there are more subtle maintainability issues with
implicitly passing data in global variables. Code that
is explicit about where data that is being acted on came
from is better than code which hides that information
This is also why I dislike local. Oh, I know when to use
it and I do use it correctly. But I prefer not needing it.
Perl has too many scoping mechanisms whose interactions are
too baroque. Rather few people really understand it, and
when people are working with interfaces they don't
understand they get confused and make mistakes. (Often
without knowing that they made mistakes.) As the
documentation says, local is probably not what you wanted
to use, my is generally more appropriate...