12 Nov 2015 18:11:11 UTC
- Distribution: Lingua-EN-Numbers-Years
- Module version: 1.05
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Testers (1025 / 1 / 0)
- KwaliteeBus factor: 1
- 93.75% Coverage
- License: perl_5
- Perl: v5.6.0
- Activity24 month
- Download (12.96KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
Lingua::EN::Numbers::Years - turn "1984" into "nineteen eighty-four", etc
use Lingua::EN::Numbers::Years; my $x = 1803; print "I'm old! I was born in ", year2en($x), "!\n";
I'm old! I was born in eighteen oh three!
Lingua::EN::Numbers::Years turns numbers that represent years, into English text. It exports one function,
year2en, which takes a scalar value and returns a scalar value. The return value is the English text expressing that year-number; or if what you provided wasn't a number, then it returns undef.
Unless the input is an at-most five-digit integer (with commas allowed), then
num2enis a function provided by Lingua::EN::Numbers), as a reasonable fall-through.
This module is necessary because English pronounces year-numbers differently from normal numbers. So the year 1984 was pronounced "nineteen eighty-four", never "one thousand, nine hundred and eighty-four".
This module makes guesses as to how to pronounce year-numbers between ten thousand and a hundred thousand -- so
year2num(10191)returns "ten thousand one ninety-one". But clearly these are not established in English usage. Yet.
year2endoesn't try to append "BC" or "AD".
Lingua::EN::Numbers - more general purpose module for turning numbers into English text.
Lingua::EN::Words2Nums - another general purpose module for converting numbers into English text. I'd recommend using the previous module.
Copyright (c) 2005, Sean M. Burke, author of the later versions.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself (perlartistic).
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.)
Sean M. Burke, email@example.com
Module Install Instructions
To install Lingua::EN::Numbers::Years, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Lingua::EN::Numbers::Years
For more information on module installation, please visit the detailed CPAN module installation guide.