my $num = 15; if ($num =~ /^[+-]?\d+$/) { print "Dealing with an integer\n"; }