To check if the value is 0, how about : if ($CGI->param('fieldname') == 0)...
Keep in mind that "three" == 0. To check if the entered value equals the single character 0, use a string comparison: $something eq '0'.
It's generally a good idea to warn if the user didn't enter nothing or digits. Or, using reversed logic: warn if a non-digit character is found:
die "\$foo contains a non-digit character!\n" if $foo =~ /\D/;
++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
-- vs lbh hfrq OFQ pnrfne ;)
- Whreq
In reply to Re: Re: zero vs. empty
by Juerd
in thread zero vs. empty
by gwhite
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |