Manual Reference Pages - LINGUA::EN::NUMBERS (3)
Lingua::EN::Numbers - turn "407" into "four hundred and seven", etc.
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";
You have two hundred and thirty-four things to do today!
You will stop caring after the fifty-fourth.
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 doesnt 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.
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.
<http://neilb.org/reviews/spell-numbers.html> - a review of CPAN modules for converting numbers into English words.
The following modules will convert a number into words:
There are other modules which provide related, but not identical,
Lingua::EN::Inflect provides a lot more besides, including conversion
of singular to plural, selecting whether to use an or a before a word,
and plenty more
Lingua::EN::Nums2Words provides similar functionality,
but cant handle exponential notation, and 3.14 produces
three and fourteen hundredths instead of three point one four.
Math::BigInt::Named doesnt work.
Number::Spell doesnt handle negative numbers, exponential notation,
or non-integer real numbers. The generated text doesnt contain any commas
or the word and, so the results for long numbers dont scan.
Lingua::EN::Numbers::Ordinate provides a function that will convert
a cardinal number (such as 3) to an ordinal(3rd).
Lingua::EN::Numbers::Years provides a function that will convert
a year in numerals (eg 1984) into words (nineteen eighty-four).
Lingua::EN::Fractions provides a function that will convert
a numeric fraction (eg 3/4) into words (three quarters).
Copyright (c) 2005, Sean M. Burke.
Copyright (c) 2011-2013, Neil Bowers, minor changes in 1.02 and later.
This library is free software; you can redistribute it and/or modify
it only under the terms of version 2 of the GNU General Public License
This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
(But if you have any problems with this library, I ask that you let
The first release to CPAN, 0.01, was written by Stephen Pandich
Sean M Burke took over maintenance in 2005, and completely rewrote
the module, releasing versions 0.02 and 1.01.
Neil Bowers <firstname.lastname@example.org> has been maintaining the module
|perl v5.20.3 ||LINGUA::EN::NUMBERS (3) ||2015-11-07 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.