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


in reply to What to use instead of global variables

I'm trying to write code to comply with Perl best practices...
Please don't do this. As the quote at the top of the page says, "P is for Practical." Write your programs to solve your problems, not to please language scolds on the internet.
  • Comment on Re: What to use instead of global variables

Replies are listed 'Best First'.
Re^2: What to use instead of global variables
by Anonymous Monk on Mar 28, 2012 at 20:43 UTC

    While you have a point (do not follow style for style's sake), these "language scolds" are quite correct when the goal is to write maintainable code. (And it should be, for any non-small program!) If you think you will never have to revisit your code to fix or improve it (say, a one-time script), you are indeed free to ignore best practises and just write something that works.

    Thus spake the master programmer:
    "Though a program be but three lines long, someday it will have to be maintained."