CM Analyst wrote:
> I am quite new to programming and Perl, so please bear
> with me.
> 
> I have a requirement to check the format of a field
> before a record can be saved. The format of the field
> needs to be double digit value separated by a .
> (period) like "00.00.00". This I managed to do using
> the following:
> 
> use strict;
> use warnings;
> 
> my $field;
> 
> print "This program will verify field value.\n";
> 
> print "Enter field value:  ";
> 
> $field = <STDIN>;
> 
> chomp ($field);
> 
> if ( $field =~ /^[0-9]{2}\.[0-9]{2}\.[0-9]{2}$/ )
        Simplest is change the {2} to {1,2} for all your entries. Now you mush 
have from 1 to 2 digits.
Wags ;)
> 
> {
> print "Value is OK";
> }
> else
> {
> print "Value is Wrong. Please enter a double digit
> value like 00.00.00";
> }
> ###########
> 
> However, the requirement has changed in that we while
> we want to allow the "00.00.00" format we do not a 0
> (zero) to be a leading value.
> 
> How can this be accomplished?
> 
> Please advise.
> 
> Regards.
> 
> Amad
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/



*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to