Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Re: Our, use vars, and magic, oh my!

by chipmunk (Parson)
on Aug 23, 2001 at 23:16 UTC ( [id://107477]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Our, use vars, and magic, oh my!
in thread Our, use vars, and magic, oh my!

You seem to be looking for an answer that says, "You absolutely should use my..." or "You absolutely should use our..." to declare variables at the top of the script. Well, there really isn't a definite answer like that. It partly depends on how you're using the variables, and partly on personal preference.

If you are only using the variables from within that file, then you can declare with my. But you can still declare with use vars or our as well. It's really up to you. The script you're asking about should work the same whichever way you declare %TOC.

If you are accessing the variables from another file, then you have to declare with use vars or our. They are mostly the same when used at the top of the file, but our has the unusual behavior of crossing package boundaries.

Personally, I still do most of my coding for perl5.005, so I don't use our. I generally use my, except when I'm declaring packing variables or working with mod_perl.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://107477]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-29 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found