But it is always getting interpreted as a number. Could somebody help me distinguish between the values '1' and 1 as in the above codemy $var = { 'key1' => '1', 'key2' => 1 }; print "Key1: It is a number\n" if ( $var->{'key1'} =~ /^-?\d/ ) ; print "Key2: It is a number\n" if ( $var->{'key2'} =~ /^-?\d/ ) ;
In reply to How to check if a scalar value is numeric or string? by bgupta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |