$dataEntry =~ m{ \A # beginning of string \+? # optional plus sign \d+ # one or more digits \z # end of string }xms #### use Regexp::Common qw( number ); $dataEntry =~ /$RE{num}{int}/ && $dataEntry == abs $dataEntry #### m{ \A # beginning of string \+? # optional plus sign [0-9]* # optional digits, including zero [1-9] # mandatory non-zero digit [0-9]* # optional digits, including zero \z # end of string }xms