Lingua:...:Numbers(3)

πŸ“¦
version 2.03 Β· 3 versions
, in fedora 43

πŸ’– Lingua::EN::Numbers β€” the Perl page, but make it cute πŸ’–

okay so bestie, this is Lingua::EN::Numbers, a Perl module from the User Contributed Perl Documentation collection, and it does the most delightful thing ever: it takes a number and says it out loud in English. yes literally. 407 becomes "four hundred and seven". slay.


✨ NAME ✨

Lingua::EN::Numbers β€” turn 407 into four hundred and seven, etc. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the vibe, look at her go:

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";

and it prints:

You have two hundred and thirty-four things to do today!
You will stop caring after the fifty-fourth.

iconic. no notes. πŸ‘‘


πŸ’… DESCRIPTION πŸ’…

this module hands you a function called num2en, and what it does is take a number (like, say, 123) and turn it into English text ("one hundred and twenty-three"). it's giving translator but make it math.

it ALSO gives you num2en_ordinal, which turns a number into its ordinal form in words β€” so 54 becomes "fifty-fourth". cute, right?

lowkey important: if you pass either function something that does not look like a number, they will return undef. so check your input bestie, don't be messy. 😭

here's what this module can handle, fr fr:

  • integers like 12 or -3
  • real numbers like 53.19
  • exponential notation β€” it turns 4E9 into "four times ten to the ninth"
  • and it even turns INF, -INF, and NaN into "infinity", "negative infinity", and "not a number", respectively. the range?? unmatched. 🌈

also: any commas in the input numbers are just ignored. commas who? never heard of her. 🫢


🌸 LEGACY INTERFACE 🌸

storytime. the very first version of this module, 0.01, released in May 1995, had an OO interface. very 90s of her. that interface was finally dropped in the 1.08 release. rip to a legend, she's gone now. πŸ’€


⭐ SEE ALSO ⭐

first up, a whole review situation:

then, the modules that will convert a number into words:

  • 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. she does it all, main character energy fr.
  • Lingua::EN::Nums2Words β€” provides similar functionality, but can't handle exponential notation, and 3.14 produces "three and fourteen hundredths" instead of "three point one four". not the vibe honestly. πŸ™ˆ
  • Math::BigInt::Named β€” doesn't work. that's it. that's the review. πŸ’€
  • Number::Spell β€” doesn't handle negative numbers, exponential notation, or non-integer real numbers. and the generated text doesn't contain any commas or the word 'and', so the results for long numbers don't scan. no commas?? no 'and'?? bestie that's a crime.

and then there are other modules which provide related, but not identical, functionality:

  • 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").

πŸŽ€ REPOSITORY πŸŽ€

the source lives here, go be nosy:

<https://github.com/neilb/Lingua-EN-Numbers>


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.) 🫢


πŸ‘‘ AUTHOR πŸ‘‘

  • 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.

and that's the whole page bestie, mwah πŸ’‹ this one's perl v5.42.0, dated 2025-07-25, and it's the Lingua:...:Numbers(3) page β€” go forth and spell numbers, you absolute icon πŸ¦‹βœ¨πŸŒΈ

πŸ“¦ where this page comes from