++ed by:
Neil Bowers


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.


Lingua::EN::Numbers provides a function num2en that converts a number (such as 123) into English text (such as "one hundred and twenty-three"). It also provides a function num2en_ordinal that 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.


Note: this legacy interface is now deprecated, and will be dropped in a future release. Please let me (Neil) know if you're using this interface, and I'll do something to continue supporting you.

For some amount of backward compatibility with the old (before 1.01) version of this module, the old OO interface is supported, where you can construct a number object with new([optionalvalue]), change its value with parse(value), and get its Engish expression with get_string().


http://neilb.org/reviews/spell-numbers.html - a review of CPAN modules for converting numbers into English words.

Lingua::EN::Nums2Words, Math::BigInt::Named, Number::Spell, Lingua::EN::Numbers::Ordinate, Lingua::EN::Numbers::Years, Lingua::EN::Inflect.




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 (perlgpl).

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 me know.)


The first release to CPAN, 0.01, was written by Stephen Pandich in 1999.

Sean M Burke took over maintenance in 2005, and completely rewrote the module, releasing versions 0.02 and 1.01.

Neil Bowers <neilb@cpan.org> has been maintaining the module since 2011.

Hosting generously
sponsored by Bytemark