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.
|
|---|