Joel Divekar wrote:
> Hi
Hello,
> I am having a small program which parses data file.
> The data file contains decimal values and I am not
> able to validate the decimal number.
>
> For eg. the decimal number will be as follows
>
> Max Size : 9.99
> valid values : 3.00 or 745.15 or 21576.00
On Dec 1, 2005, at 8:21, Joel Divekar wrote:
For eg. the decimal number will be as follows
Max Size : 9.99
valid values : 3.00 or 745.15 or 21576.00
invalid values : 3.001 or 745.1555 or 215766.00
also 3..00 should be marked invalid.
Looks like the validity depends on the digits around th
Try this
if ($a=~/^\d{0,5}\.\d{0,2}$/)
Regards
Hridyesh
-Original Message-
From: Joel Divekar [mailto:[EMAIL PROTECTED]
Sent: 01 December 2005 12:52
To: beginners@perl.org
Subject: Validating Decimal Values
Hi
I am having a small program which parses data file.
The data file contains
Hi
I am having a small program which parses data file.
The data file contains decimal values and I am not
able to validate the decimal number.
For eg. the decimal number will be as follows
Max Size : 9.99
valid values : 3.00 or 745.15 or 21576.00
invalid values : 3.001 or 745.1555 or 215766.