Skip to content

Instantly share code, notes, and snippets.

@jdittmarCodeSnippets
Last active May 6, 2019 15:47
Show Gist options
  • Save jdittmarCodeSnippets/5357923 to your computer and use it in GitHub Desktop.
Save jdittmarCodeSnippets/5357923 to your computer and use it in GitHub Desktop.
Perl: isNumeric
# returns true if the value passed to it is numeric, false otherwise
sub isNumeric{
no warnings;
use warnings FATAL => 'numeric';
return 0 if(!defined $_[0] || $_[0] eq '' );
return defined eval { $_[ 0] == 0 };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment