No, I didn't want 0.00 to be valid.
I want a user to enter a start price for an auction, I don't want 0.00 or
negative numbers to be valid.
if $number =~ /^\d*\.\d\d$/;
works fine
I've added a second check to look for 0.00
thanks
----- Original Message -----
From: "Tad McClellan" <>
Newsgroups: comp.lang.perl.misc
Sent: Sunday, April 18, 2004 4:34 PM
Subject: Re: help: 2 digit number problem
> cb <> wrote:
>
> > How do I check if $number is a positive number to 2 decimal places?
>
>
> print "valid\n" if $number =~ /^\d*\.\d\d$/; # untested
>
>
> > ie.
>
>
> You meant "eg." rather than "ie." there.
>
>
> > 0.00 invalid
>
>
> Why is that invalid?
>
> Looks like 2 decimal places to me...
>
> Is it a mistake in your examples or a mistake in your specification?
>
>
> --
> Tad McClellan SGML consulting
> Perl programming
> Fort Worth, Texas