Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ferreira (5993)

  (email not shown publicly)

Just another Brazilian Perl hacker.

Journal of ferreira (5993)

Friday June 29, 2007
03:17 PM

XLII is the answer

[ #33641 ]

Acme::Roman was released to CPAN today ( With this module, it is a piece of cake to use Roman numerals in Perl.

For instance, you may try:

use Acme::Roman;

print I + II, "\n"; # III, as it should
print X * 2, "\n"; # XX
print X - 'III', "\n"; # VII

print "VI! = ", VI*V*IV*III*II*I, "\n"; # VI! = DCCXX

Among the distribution files, there are more examples in eg/

Only an implementation issue made me sad: a brute force method needed to force barewords into subs, resolved by an imported AUTOLOAD. It seems like Ruby got the upper hand over Perl this time. See the explanation at a node I wrote at PerlMonks: AUTOLOAD, overload, and Roman numerals for Perl.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.