Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Perl Number to Text Representation. For checks

Status
Not open for further replies.

aswolff

Programmer
Jul 31, 2006
100
US
Hello,

I know I've ran into this before but I am looking for a utility, script, module. That will take a number and convert it to text representation.

Example:

450.00 -> Four Hundred Fifty 00/100

128.32 -> One Hundred Twenty Eight 32/100

Thanks.
 
Have you checked out the Lingua::EN::Numbers module? (Assuming you need English)

Code:
  use Lingua::EN::Numbers qw(num2en num2en_ordinal);

  my $x = 234;
  my $y = 54;
  print "You have ", num2en($x), " things to do today!\n";
  print "You will stop caring after the ", num2en_ordinal($y), ".\n";

Prints

Code:
  You have two hundred and thirty-four things to do today!
  You will stop caring after the fifty-fourth.

That's taken directly from the CPAN site, but it sounds like what you need.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top