Lester Hightower

NAME

Lingua::EN::Nums2Words - generate English verbiage from numerical values

SYNOPSIS

  use Lingua::EN::Nums2Words;
  
  $Number   = 42;
  $Verbiage = num2word($Number);
  $Verbiage = num2word_ordinal($Number);
  $Verbiage = num2word_short_ordinal($Number);
  $Verbiage = num2usdollars($Number);

DESCRIPTION

This module provides functions that can be used to generate English verbiage for numbers.

To the best of my knowledge, this code can handle every real value from negative infinity to positive infinity.

This module makes verbiage in "short scales" (1,000,000,000 is "one billion" rather than "one thousand million"). For details see this Wikipedia article:

http://en.wikipedia.org/wiki/Long_and_short_scales

SUBROUTINES

The following code illustrates use of the four functions in this module:

  use Lingua::EN::Nums2Words;
  
  $age = 45;
  print "I am ", num2word($age), " years old.\n";
  print "I've had my ", num2word_ordinal($age), " birthday.\n";
  print "I'm in my ", num2word_short_ordinal($age+1), " year.\n";
  print "Pay me ", num2usdollars($age), ".\n";

This prints out:

  I am FORTY-FIVE years old.
  I've had my FORTY-FIFTH birthday.
  I'm in my 46th year.
  Pay me FORTY-FIVE DOLLARS AND ZERO CENTS.

As shown above, the default is to return uppercase words. If you would prefer to have lowercase words returned, make this call once, early in your program:

 Lingua::EN::Nums2Words::set_case('lower'); # Accepts upper|lower

COPYRIGHT

Copyright (C) 1996-2011, Lester H. Hightower, Jr. <hightowe@cpan.org>

LICENSE

As of version 1.13, this software is licensed under the OSI certified Artistic License, one of the licenses of Perl itself.

http://en.wikipedia.org/wiki/Artistic_License