Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Populating Arrays of Arrays

by husker (Chaplain)
on Mar 03, 2005 at 14:59 UTC ( [id://436351]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Populating Arrays of Arrays
in thread Populating Arrays of Arrays

Note that you have way too many declarations up front. Try moving the "my" closer to where each variable is first used. This is Perl, not Pascal. Thanks.

Is that really a big deal? I declare the same way (although I will group declarations together).

Replies are listed 'Best First'.
Re^3: Populating Arrays of Arrays
by Mugatu (Monk) on Mar 03, 2005 at 15:56 UTC
    Is that really a big deal?

    It's indicative of a weak understanding of lexical scope. It's a symptom of a problem, not a problem in and of itself. Putting a huge block of my declarations at the top of the file is not a whole lot better than using package variables for everything. About the only benefit you get from strict is checking for typos.

    I prefer to scope variables as tightly as possible. That means, at the latest possible time and smallest possible block for the code to still work. Then, not only do I get protection against typos in variable names, I also get protection against inadvertant action-at-a-distance.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://436351]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.