use Regexp::Common qw /number/; for ('1', 'flip', '-2.3e14', '0.01', 'flop') { /$RE{num}{real}/ and print "Yup, $_ is a number!\n"; }