The results are puzzling.What the string is: 99999999999999999999 Value of $strAsInteger: 1e+20 How printf sees it: 18446744073709551615
Perl automatically upgrades large integers to floating point.
Perl's maximum values for integers can be determined as I showed in this post.
If you want to work with integers larger than that, use Math::BigInt.
To validate number formats, use Regexp::Common::number.
Update: If two integers are the same length (or are zero-padded to be the same length), Perl's string comparisons can be used.
In reply to Re: Reliably parsing an integer (updated)
by haukex
in thread Reliably parsing an integer
by rdiez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |