I am using Perl to convert some XML to JSON. If the XML attribute is a number, I don\'t want to put quotes around it so that JSON will treat it as a number and not a string. How
You could just force it into a number then compare that to the original string.
if( $value eq $value+0 ){ print "$value is a number\n"; }
( Note: it will only work for simple numbers, like 123 or 12.3 )