Lingua:...rs::Easy(3)

πŸ“¦
this version Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

Lingua::EN::Numbers::Easy β€” bestie, it's hash access to Lingua::EN::Numbers objects. That's the whole vibe. πŸŽ€

This is a page from the User Contributed Perl Documentation, living in section 3 (that's your library calls, iykyk), and it's filed under Lingua:...rs::Easy(3).


✨ SYNOPSIS ✨

use Lingua::EN::Numbers::Easy;

print "$N{1} fish, $N{2} fish, blue fish, red fish";
                     # one fish, two fish, blue fish, red fish.

Like. Look at that. You just interpolate $N{1} and out comes "one". No object wrangling, no method calls, just vibes. πŸŸπŸ¦‹


🌸 DESCRIPTION 🌸

Okay so here's the tea. Lingua::EN::Numbers is the module that turns numbers into English words. Iconic, love her. BUT β€” and this is the part that had everyone in a chokehold β€” she's got an object oriented interface, which makes it genuinely so hard to interpolate them inside strings. It's giving "why are you like this." 😭

Enter Lingua::EN::Numbers::Easy: she translates numbers to words using a tied hash, and tied hashes can be interpolated. Problem solved, main character energy, periodt. πŸ’…

By default, Lingua::EN::Numbers::Easy exports a hash %N to the importing package. Cute, right? But you can change that! Just hand use Lingua::EN::Numbers::Easy an argument β€” that argument becomes the name of the hash that gets used instead:

use Lingua::EN::Numbers::Easy qw /%nums/;

...and boom, %nums is your tied hash now. Slay. ✨

Also, go read the Lingua::EN::Numbers man page. Seriously. See also energy.

Lingua::EN::Numbers::Easy caches results β€” so numbers only get translated once. Efficient queen. πŸ‘‘

🚨 Heads up bestie: any other operation on the exported hash than fetches will throw an exception. Fetching only. Don't try anything else, she will not allow it. πŸ’€

πŸ¦‹ History πŸ¦‹

Not me giving you the full lore. πŸ“œ

This module was created at the end of the 20th century, back when Lingua::EN::Numbers had a clunky, OO interface. Yeah. The end of the 20th century. Ancient history, fr fr.

Nowadays, Lingua::EN::Numbers has a procedural interface as well, which lessens the need for Lingua::EN::Numbers::Easy. Growth! We love to see it. 🌱

Furthermore, Lingua::EN::Numbers no longer supports different British and American modes. Therefore, the support for the modes has been dropped in Lingua::EN::Numbers as well. (Yes, the sentence really does say Lingua::EN::Numbers twice, and yes, we are keeping it exactly as it is, no cap. 🫢)

As for 2014, Lingua::EN::Numbers does not have an OO interface anymore, just a procedurial one. There's probably no need for Lingua::EN::Numbers::Easy anymore, and the reason it was created is now completely gone. πŸ’” It's giving "we did it, we made ourselves obsolete." Respect the journey though.


πŸ‘‘ AUTHOR πŸ‘‘

This package was written by Abigail, <mailto:lingua-en-numbers-easy@abigail.be>. A legend, honestly. 🌈⭐


This package is copyright 1999 - 2009 by Abigail.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

⚠️ And now the all-caps part, which we do NOT soften because it means business:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Mwah πŸ’‹ that's the whole page. This one's from perl v5.42.0, dated 2025-07-25, and it lives at Lingua:...rs::Easy(3). Go forth and interpolate your numbers, bestie. πŸ§šπŸ’–

πŸ“¦ where this page comes from