Add Perl number validation and range checking, fixes #26