This software provides a hash access to Lingua::EN::Numbers objects, enabling easy retrieval and manipulation of English numbers in a program.
Fortunately, Lingua::EN::Numbers::Easy comes to the rescue by offering an alternative approach. Instead of an object-oriented interface, it uses a tied hash to translate numbers to words, which can easily be interpolated.
Upon importing Lingua::EN::Numbers::Easy, a hash %N is exported by default to the importing package. However, you can specify a name for the hash to be used instead by giving an argument when calling the module. For instance, the following line of code would use %nums as the tied hash:
use Lingua::EN::Numbers::Easy qw /%nums/;
Do check out the Lingua::EN::Numbers man page for additional information. One noteworthy feature of Lingua::EN::Numbers::Easy is that it caches results, meaning each number will only be translated once. Any other operation on the exported hash than fetches will throw an exception.
In terms of usage, you can simply use Lingua::EN::Numbers::Easy, and then interpolate numbers within your code using the %N hash. For example:
use Lingua::EN::Numbers::Easy;
print "$N{1} fish, $N{2} fish, blue fish, red fish";
This would output the following result:
one fish, two fish, blue fish, red fish.
Version 2009040201: N/A