Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Re: Adding 2 + 2

by Juerd (Abbot)
on Dec 21, 2001 at 16:30 UTC ( #133743=note: print w/ replies, xml ) Need Help??

in reply to Re: Adding 2 + 2
in thread Adding 2 + 2

A very creative solution :)
Be sure to check out Roman if you didn't know it already. It can convert roman numbers both ways, and checks if your roman input is valid.

use Roman; $calc = "II + II"; $calc =~ s/([MDCLXVI]+)/isroman($1) ? arabic($1) : $1/; print eval $calc;

2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Comment on Re: Re: Adding 2 + 2
Select or Download Code
Replies are listed 'Best First'.
Re: Re: Re: Adding 2 + 2
by mr_mischief (Monsignor) on Jan 02, 2002 at 20:22 UTC
    Thanks for the review and the suggestion.

    I knew Roman was available, but it didn't feel right to use it for this. I felt it was more in the spirit of the thread to go overboard and develop the needed tools specifically for the node. I'm actually a bit surprised it took someone posting a hand-crafted Roman to Arabic numeral conversion before someone gave an example using the module. It was one of the first twists on the problem that popped into my deranged mind.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://133743]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2015-11-27 16:01 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (731 votes), past polls