Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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.

In reply to Re: Re: Re: Our, use vars, and magic, oh my! by chipmunk
in thread Our, use vars, and magic, oh my! by OzzyOsbourne

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2023-09-25 15:56 GMT
Find Nodes?
    Voting Booth?

    No recent polls found