http://qs1969.pair.com?node_id=353003


in reply to Numbers with commas

As far as I know, Perl only allows underscores as number beautyfiers, like 1_000_230 instead of 1,000,230, but I guess they get thrown out by the parser as soon as they're found.

The point with parsing a (maybe user input) string is that there is no correct way to handle commas and dots if yuou don't take you LOCALE into consideration. The string 2,500 written by an american is two thousand five hundred, by an italian is two and a half. And such numbers can be rather ambiguous, both in reading and in input. The standard computer notation uses only the dot for the decimal part and no commas and it's in most cases unambiguous. In all other cases you'll have to rely on the locale, and you should not expect a language to do it by itself (Java does if you don't tell it; but then, how do you know which version of the system was installed on the Linux box of your Hungarian branch?)