Lingua::EN::Numbers3pm
Turn "407" into "four hundred and seven", etc.
Usage
use Lingua::EN::Numbers qw(num2en num2en_ordinal);my $x = 234;my $y = 54;print "You have ", num2en($x), " things to do today!\n";print "You will stop caring after the ", num2en_ordinal($y), ".\n";
prints:
You have two hundred and thirty-four things to do today!You will stop caring after the fifty-fourth.
Overview
This module provides a function "num2en", which converts a number (such as 123) into English text ("one hundred and twenty-three"). It also provides a function "num2en_ordinal", which converts a number into the ordinal form in words, so 54 becomes "fifty-fourth".
If you pass either function something that doesn't look like a number, they will return "undef".
This module can handle integers like "12" or "-3" and real numbers like "53.19".
This module also understands exponential notation -- it turns "4E9" into "four times ten to the ninth"). And it even turns "INF", "-INF", "NaN" into "infinity", "negative infinity", and "not a number", respectively.
Any commas in the input numbers are ignored.
Legacy interface
The first version of this module, 0.01 released in May 1995, had an OO interface. This was finally dropped in the 1.08 release.
Repository
<https://github.com/neilb/Lingua-EN-Numbers>