use strict; use warnings; use Regexp::Common qw/ number /; print for grep /^$RE{num}{int}$/, ; __DATA__ 3.14 10 -42 42 .14159 12.34e-56 3.0 Hello, world.