Hi, Using regex, I have taken a value and now I want to report a error message if it is not a numeric value. My lines are below:
if($_ =~ /<blk id="(.+?)"\/>/g) { my $blk=$1; if($blk != \d){print "Invalid value"} }
Now, whether the value is 1 or abc, I am not getting the error. It should accept 1 but not abc. Could anyone help me to identify what's wrong in the code?
In reply to Checking whether a value is numeric or not by rsriram
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |