Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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

by chipmunk (Parson)
on Aug 23, 2001 at 23:16 UTC ( #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.

  • Comment on Re: Re: Re: Our, use vars, and magic, oh my!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2023-09-30 09:06 GMT
Find Nodes?
    Voting Booth?

    No recent polls found