is_numeric review, with fallback to looks_like_number

This commit is contained in:
fbsanchez 2019-10-02 11:33:43 +02:00
parent 8e204605e5
commit 8bb1e4ed2d
1 changed files with 2 additions and 1 deletions

View File

@ -569,7 +569,8 @@ sub is_numeric {
my $SIGN = qr{ [+-] }xms; my $SIGN = qr{ [+-] }xms;
my $NUMBER = qr{ ($SIGN?) ($DIGITS) }xms; my $NUMBER = qr{ ($SIGN?) ($DIGITS) }xms;
if ( $val !~ /^${NUMBER}$/ ) { if ( $val !~ /^${NUMBER}$/ ) {
return 0; #Non-numeric #Non-numeric, or maybe... leave looks_like_number try
return looks_like_number($val);
} }
else { else {
return 1; #Numeric return 1; #Numeric