Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: vallidating a regular expression

by Samy_rio (Vicar)
on May 11, 2006 at 06:59 UTC ( [id://548622]=note: print w/replies, xml ) Need Help??


in reply to vallidating a regular expression

Hi s_gaurav1091, If I understood your question correctly then here is my try,

$totalNumber = sprintf "%02d", 1; if($totalNumber =~ /^\d{2}$/){ if($totalNumber <= 10){ print "the number is less than 10\n"; } }

If you assign two digit integer with preceding zero to the variable then that variable doesn't hold the preceding zero. Since your first condition fails. See below,

$totalNumber = 01; print $totalNumber;

Regards,
Velusamy R.


eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://548622]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-16 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found