|laziness, impatience, and hubris|
Re: Best guess for data typeby LanX (Chancellor)
|on Apr 22, 2013 at 22:52 UTC||Need Help??|
> For example, given 100 numbers would guess that its a numerical array while mixed strings and numbers would return that the best data type is string.
depends on your definition of number, but I think this helps:
> I am thinking along the lines of what most statistical applications do when you load a CSV file and they try to guesstimate what data type each column is.
scalar grep returns a number, your free to check for thresholds.
you could also use Scalar::Util which is core
please not that now strings like " 4 " are considered numbers!
As I said depends a lot on your definition... =)
( addicted to the Perl Programming Language)