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
I think this question from perlfaq solves your problem.
Generally the problem is defining what exactly you want to read as number.