This answer on stackoverflow seems to do what you want (based on the fact that the bitwise & operator has a different output depending on the type of the scalar) with pure perl. I suppose there is a XS module somewhere that lets you know precisely what there is inside the SV.
But as stated in the above post, the fact that a variable has a numerical value does not only depend on its declaration, but also on whether or not it was ever used in numerical context:
perl -MData::Dumper -E '@a = (1, "1", 1, "1", "1o"); say "$a[2]"; say +$a[4]+$a[3]; say Dumper \@a' 1 2 $VAR1 = [ 1, '1', 1, 1, '1o' ];
Edit: added "output" in my parenthesis, because why would I write all the words on the first try?
In reply to Re: How can I test for the representation of an integer?
by Eily
in thread How can I test for the representation of an integer?
by sm@sh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |