in reply to Re^5: Reliably parsing an integer
in thread Reliably parsing an integer
Your solution is interesting, thanks.
The trouble is, I do not really trust the "int $num eq $num;" expression. I have seen that 'int' can do weird things, and I am not convinced that there is no floating-point corner case somewhere on some hardware that spits out something that looks like an integer, because some inaccuracy cancels out when generating a string from it.
Besides, the "eq" is actually converting the integer back to a string, which will cost performance. I think I can write faster code with the steps I outlined above. Stay tuned.
In Section
Seekers of Perl Wisdom