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
It might be easier for you to just read the XML into a data structure in Perl and let Perl's JSON library figure it out for you. It already has checking for that, so unless your number is actually a string in the XML (e.g. it's got a space after it, etc) JSON->encode()
will encode it as a JSON number.