Perlfunc: is_number

sub is_number() {
    my $in = shift();
    if (!defined($in)) { return 0; }

    # If there are any non-number characters in it no good!
    if ($in =~ /^-?[0-9.]+$/) {
        return 1;
    } else {
        return 0;
    }
}
Leave A Reply
All content licensed under the Creative Commons License