I agree with people that you should keep
-w in production
code. Sure, it does mean you might have to add some more code where you
otherwise could get away with cutting corners. But if later the customer
comes with "it doesn't work", and you have nothing else to fall back on
(nothing in the error logs), it might be hard to fix the problem, while
it would have been trivial if you had the warning(s).
I am however surprised about the suggested "fixes" several of the previous
posters gave. Just checking whether $USER {coffee} exists or
is defined fixes all possible warnings! Sure, it avoids the
use of uninitialized value warning, but clearly, the form input
hasn't been checked for sanity! What if $USER {coffee}
contains Java? Argument "java" isn't numeric in
numeric gt isn't much better as warning message.
You cannot trust form input. Don't assume it's there, and don't assume
it's in the format you want it to be. Don't assume it's a number just
because you are going to use it as a number.
-- Abigail
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.