Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Kiat,

Fret ye not: This is not a lame question but rather relates to an article of the faith for Perlmonks.

The strict answer to your question (excuse the bad pun) is no, you do not need to declare the variables if you are not using the strict pragma. This means you will need to declare all of your variables using my which is generally agreed to be a good idea.

A slightly better answer is that you should (nearly) always use strict; and preferably the -w switch or the warnings pragma too (These two are very slightly different if you're using Perl 5.6 or later, see this for more info.) If there is a good reason why you shouldn't be using strict there is probably a far better and/or safer way of doing what you are trying to do!

There are lots of very good reasons why you should use strict; and warnings and if you are doing CGI work -T too: You will be warned about typos in your variable names because the code won't run and will give you the location of the (probable) typo, warnings will give you more useful debugging information about nonfatal errors in your code and -T, well let's just say that it can make life a more pleasant experience for everybody except anyone trying to do unpleasant things to your website. All of the links given by the other posters will be damned helpful, good luck.

Elgon

PS: Oh, and welcome to <a href="http://"www.perlmonks.org">Perlmonks!

"Without evil there can be no good, so it must be good to be evil sometimes.
--Satan, South Park: Bigger, Longer, Uncut.


In reply to Re: using 'my' by Elgon
in thread using 'my' by kiat

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (14)
    As of 2014-09-18 08:41 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (109 votes), past polls