in reply to Are global variables "bad"?

So, my question boils down to: is it a bad idea to have global variables?
There are several answers to your question. Let me just give a few remarks.

Replies are listed 'Best First'.
Re^2: Are global variables "bad"?
by Anonymous Monk on Apr 21, 2009 at 20:34 UTC
    "Perl 1, 2, 3 and 4 didn't have lexical variables. Or name spaces. All variables where global"
    Where did the local statement fit into this absolutist scheme?
        local only works on global variables.
        Not true. It's not even true if you meant "package" where you wrote "global".
        $ perl -wE 'my @a = (1, 2, 3); {local $a[1] = 7; say "@a";} say "@a"' 1 7 3 1 2 3
      local() essentially replaces the current variable (package variable - or aggregate element) with another variable, until the runtime exits the scope the local() is in.

      If no magic is involved, it may be easier to think of it as temporary replacing the value.