Hey there.

You could do it like this.

If your check is just about noticing that the zip code is 5 chars, use length:
unless ( length $f_zip == 5 ) { $f_zip_error = "<font color=\"red\">Zip code cannot be blan +k and must be 5 digits in length.</font><BR>\n"; $p_Terrors = $p_Terrors + 1; }
For the state part, in drop-down cases I always do it like this:

- The first option is null like:
<option value="null">Select the state</option> - So your code change into this:
if ($f_state eq "null") { $f_state_error = "<font color=\"red\">State may not be blank.</ +font><BR>\n"; $p_Terrors = $p_Terrors + 1; + } ...
Hint: Since it's a drop-down box, it will always return a value, so you can't use something like:
if (! defined $f_state) { ...
or
if ($f_state eq "") { ...
Hope it helps.

my ($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br") if ($author_name eq "Er Galvão Abbott");

In reply to Re: Perl Form Validator problems. by DaWolf
in thread Perl Form Validator problems. by DigitalKitty

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!
  • 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:
    & &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.