Is there a better way of doing this?
Thanks!
Dave
----


if ($in{'price'} eq "") {print '<font color="red">&#8226; Missing</font> '; }  
 elsif (&checkPrice($in{'price'})) {
  print '<font color="red">&#8226; Wrong Format</font>';
}

....


sub checkPrice{

if ($_[0] =~ /\$?(\d*)(\.\d{0,2})?/) {
return 1; 
    } else {
return 0;
    }

}


Allowable input: 
$1
$1.50
2
.50
$.50
-----
Not allowable input: 
a
$5a
$e.40
------

Reply via email to