http://qs321.pair.com?node_id=11118670


in reply to Re^2: Reliably parsing an integer
in thread Reliably parsing an integer

To validate number formats, use Regexp::Common::number. [emphasis added]
How are these regular expressions going to help? ... How is a regular expression going to help me accept 4294967295 ... but not 4294967296 ...?
Regexes can help validate number formats, but not, in general, ranges. (It's quite often possible to construct a regex to discriminate a number range, but this is usually more of an academic exercise than a practical solution. Common exceptions are for decimal octet and year/month/day ranges.)

... command-line option --resume-from-line ...

This quote from the OP suggests the user is to enter a simple line number of a file. Are you really dealing with source/data/whatever files of more than 4,000,000,000 (or 18,446,744,073,709,551,615 or, God help us all, 99,999,999,999,999,999,999) lines? If not, what do you care if your Perl is UINT32_MAX or UINT64_MAX? Why not just use a validation test something like
    $n !~ /\D/ && $n < 4_000_000_000
(or some more reasonable upper limit) and be done with it?

Or is your question intended to address a more general case?


Give a man a fish:  <%-{-{-{-<