in reply to Comparison based on type of value held by variables
Instead of regexp recipes, you can always perform
the addition and catch the exception. The FATAL keyword
bellow will elevate the warning to an exception - check
$0 to find if one was raised. (Normally, statements like
$var = '3a' + 3 are not fatal.)
my $var = '-.3'; use warnings FATA=> 'numeric'; my $a = eval '$var + 3'; print 'Not a number' if $@;
|
---|
In Section
Seekers of Perl Wisdom