blazar has asked for the wisdom of the Perl Monks concerning the following question:

I've done quite a number of IMHO reasonable searches on CPAN for a module to spell out numbers in English, but I'm having a hard time finding one. Maybe I'm not just that reasonable nor skilled in searches... After some efforts I could locate Math::BigInt::Named, but I am having troubles with it (this is the subject of another question)... and while I do want to solve them, if not for anything else because I can't understand what's going wrong, I would also like to know if there are other modules suited for my needs, taking into account that I don't really need to operate on big integers. If none exists, then I will probably steal code from Math::BigInt::Named::English, but that's my last resort.

Update: thanks to both gjb and andreas1234567 for the suggestions. It seems my search-jutsu is not that refined: I had been searching for various combinations of qw/number string english inflect spell name/...

Replies are listed 'Best First'.
Re: Please suggest a module to spell out numbers
by gjb (Vicar) on Aug 28, 2007 at 11:17 UTC

    Have a look at the Lingua::*::Numbers on CPAN. Number to your language of choice conversion.

    HTH, -gjb-

Re: Please suggest a module to spell out numbers
by andreas1234567 (Vicar) on Aug 28, 2007 at 12:02 UTC
    After installing Lingua::FR::Numbers, Lingua::IT::Numbers and Lingua::EN::Numbers, then Lingua::Any::Numbers produces:
    $ perl -l use strict; use warnings; use Lingua::Any::Numbers qw(:std); foreach my $lang ( available ) { print join(q{,}, map { to_string( $_, $lang ) } (1 ..9)); print join(q{,}, map { to_ordinal( $_, $lang ) } (1 ..9)); } __END__ un,deux,trois,quatre,cinq,six,sept,huit,neuf 1,2,3,4,5,6,7,8,9 one,two,three,four,five,six,seven,eight,nine first,second,third,fourth,fifth,sixth,seventh,eighth,ninth uno,due,tre,quattro,cinque,sei,sette,otto,nove 1,2,3,4,5,6,7,8,9
    --
    Andreas
Re: Please suggest a module to spell out numbers
by Anonymous Monk on Aug 29, 2007 at 09:18 UTC