in reply to How can I test for the representation of an integer?
From Modern Perl book:
The internal data structure which represents a scalar in Perl 5 has a numeric slot and a string slot.Infact:The dualvar() function within the core Scalar::Util module allows you to manipulate both values directly within a single scalar. Similarly, the module’s looks_like_number() function returns true if the scalar value provided is something Perl 5 would interpret as a number.
L*perl -MData::Dumper -E "say for Dumper([ 1, '1' ]),eval qq(1+'1'), len +gth qq(1....).1;" $VAR1 = [ 1, '1' ]; 2 6
|
|---|