Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Item Description: Counting in roman numbers
Review Synopsis: Simple but convenient, limited to 4000
Roman is a module for conversion between Roman and Arabic numerals.
use Roman; $arabic = arabic($roman) if isroman($roman); $roman = Roman($arabic); $roman = roman($arabic);
Note: the module does not have a Makefile.PL, so you will have to copy it in your perl module path yourself that should be something like /usr/lib/perl5/site_perl/5.6.0/. Alternatively you can use ExtUtils::MakeMaker to generate a Makefile.PL:
perl -e 'use ExtUtils::MakeMaker; WriteMakefile(NAME => "Roman");'Roman is a little module that I found when I had to convert Roman numbered lists from XML to HTML. Instead of spending half an hour remembering how those guys counted then writing it myself it took me 5 minutes to install a generic solution. Cool!
I guess now with Unicode being available the module could be upgraded to handle more numbers.
Update: it might look like Dominus does not quite like Roman: Roman.pm is a new contender for stupidest Perl module ever written. but he is actually talking about a different module, one he wrote himself and apparently never submitted to CPAN, which allows you to write things like $IV+$IV and get VIII as a result.
|
---|