Perlfunc: is_numeric()

Simple Perl function to tell if a string is numeric.

sub is_numeric {
    if ($_[0] =~ m/^[+-]?\d+(\.\d+)?$/) {
        return 1;
    }

    return 0
}


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 2600:1f28:365:80b0:8598:46ec:afcc:e5d4
To prevent spam please submit by clicking the kitten: