.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Lingua::EN::Numbers 3" .TH Lingua::EN::Numbers 3 2024-07-13 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Lingua::EN::Numbers \- turn "407" into "four hundred and seven", etc. .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Lingua::EN::Numbers qw(num2en num2en_ordinal); \& \& my $x = 234; \& my $y = 54; \& print "You have ", num2en($x), " things to do today!\en"; \& print "You will stop caring after the ", num2en_ordinal($y), ".\en"; .Ve .PP prints: .PP .Vb 2 \& You have two hundred and thirty\-four things to do today! \& You will stop caring after the fifty\-fourth. .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module provides a function \f(CW\*(C`num2en\*(C'\fR, which converts a number (such as 123) into English text ("one hundred and twenty-three"). It also provides a function \f(CW\*(C`num2en_ordinal\*(C'\fR, which converts a number into the ordinal form in words, so 54 becomes "fifty-fourth". .PP If you pass either function something that doesn't look like a number, they will return \f(CW\*(C`undef\*(C'\fR. .PP This module can handle integers like "12" or "\-3" and real numbers like "53.19". .PP 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. .PP Any commas in the input numbers are ignored. .SH "LEGACY INTERFACE" .IX Header "LEGACY INTERFACE" The first version of this module, 0.01 released in May 1995, had an OO interface. This was finally dropped in the 1.08 release. .SH "SEE ALSO" .IX Header "SEE ALSO" \- a review of CPAN modules for converting numbers into English words. .PP The following modules will convert a number into words: .IP \(bu 4 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 .IP \(bu 4 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". .IP \(bu 4 Math::BigInt::Named doesn't work. .IP \(bu 4 Number::Spell doesn't handle negative numbers, exponential notation, or non-integer real numbers. The generated text doesn't contain any commas or the word 'and', so the results for long numbers don't scan. .PP There are other modules which provide related, but not identical, functionality: .IP \(bu 4 Lingua::EN::Numbers::Ordinate provides a function that will convert a cardinal number (such as "3") to an ordinal ("3rd"). .IP \(bu 4 Lingua::EN::Numbers::Years provides a function that will convert a year in numerals (eg "1984") into words ("nineteen eighty-four"). .IP \(bu 4 Lingua::EN::Fractions provides a function that will convert a numeric fraction (eg "3/4") into words ("three quarters"). .SH REPOSITORY .IX Header "REPOSITORY" .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (c) 2005, Sean M. Burke. .PP Copyright (c) 2011\-2013, Neil Bowers, minor changes in 1.02 and later. .PP 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). .PP 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. .PP (But if you have any problems with this library, I ask that you let me know.) .SH AUTHOR .IX Header "AUTHOR" The first release to CPAN, 0.01, was written by Stephen Pandich in 1999. .PP Sean M Burke took over maintenance in 2005, and completely rewrote the module, releasing versions 0.02 and 1.01. .PP Neil Bowers has been maintaining the module since 2011.