Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: vallidating a regular expression

by Samy_rio (Vicar)
on May 11, 2006 at 06:59 UTC ( #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
Node Status?
node history
Node Type: note [id://548622]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2018-01-17 13:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (200 votes). Check out past polls.

    Notices?