Is there a better way of doing this? Thanks! Dave ---- if ($in{'price'} eq "") {print '<font color="red">• Missing</font> '; } elsif (&checkPrice($in{'price'})) { print '<font color="red">• 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 ------
- Re: Validating price (US Currency) David Gilden
- Re: Validating price (US Currency) Paul Johnson
- Re: Validating price (US Currency) Paul Johnson
- Re: Validating price (US Currency) Casey West