die "$var non-numeric" if $var =~ /[^0-9]/; #dies if it starts with - $var =~ s/^0*//; #this will remove any leading zeros