This is a good node that will answer both of your questions.
Use strict and warningsHere are my own takes on these subjects:
Using "my" is generally a good idea. It sets the scope of the variable it's applied to to be localized instead of global. I'm sure others here can provide a much more detailed explanation of it. Basically, my recommendation is to use it whenever possible, except in times when you explicitly do not want to use it for a very good reason. "You have to know the rules in order to break them", that kind of thing.
Regarding "strict", that's also a good thing to use whenever possible. Just like "my", only turn it off when you have a good reason to and you know exactly what you're doing. Strict forces you to write "better" code, in the sense of barewords, subs, variable scoping and the like. One of the things "strict" does is it forces you to scope all your variables using "my", "local", "our", or the package name.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.