sub isNumeric {
my $value = shift;
# Only a number with value of zero, OR a string equal to '0' will eq '0',
# (since 0.0000 is represented by just 0)
# but a real number and a string other than '0' will not eq '0'.
if( $value eq '0' ) {
return 1; # Return perl true (1) since even a string equal to '0' is still a number.
} else {
# Here $value is either a number not equal to zero, or a string not equal to '0'.
$value *= 1;
if( $value == 0 ) {
# If we multiply a string by 1, it will equal zero.
return 0;
} else {
# $value must be a number not equal to zero.
return 1;
}
}
}