|Pathologically Eclectic Rubbish Lister|
Number::Spellby PERLscienceman (Curate)
|on Jan 28, 2004 at 01:07 UTC||Need Help??|
Item Description: Perl extension for spelling out numbers.
CPAN LINK: Number::Spell
Bug(s) Found: Stops working properly after 100 Trillion.
I think this would be a really cool module if it worked properly past 100 Trillion. Has anyone else tried it and had the same result? Another possiblity would be for interpreting reals, although that would probably be pretty dicey to implement especially with a number like 1.09873532 . The author did mention this possibility in the original version.
I did a little digging into the module and determined that when you go one place above 100 Trillon (1000000000000000), the number then get interpreted or changed into exponential format by the interpreter so instead of 1 Quadrillion as 10000000000000000, it is 1e16, which is not recognized/proper split by the regex inside the if statement on line 83 of spell.pm .
With a little more tinkering/experimentation with the demo script I have determined that such a large number will work with the module if you send it as a quoted string.
The ultimate solution would be to fix the regex on line 83 in spell.pm to deal with the exponential format. Unfortunately a regex wizard I am not. So.... I would be inclined to leave that in the hands of the author or someone who knows more of regexes than I do. :)