in reply to Re: Portable way of checking if a scalar is a number / integer / float
in thread Portable way of checking if a scalar is a number / integer / float
Thank you for pointing me to Scalar::Util::Numeric::PP. I installed it using CPAN and copied over the source into my repo and it works.
use lib dirname(__FILE__); do "Scalar/Util/Numeric/PP.pm" or die;
To your point that:
Yes, even you can use CPAN, and so can your users.
For now my quick-and-dirty solution is sufficient. If I find myself adding more dependencies I'll create an install script that installs cpan and the necessary libraries.
Thanks for the tip about scalars. It had slipped my mind that strings and numbers have distinct internal representation in Perl
Edit: solution was incorrect; I fixed it.
|
|---|