Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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:~$

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2018-02-19 18:41 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (266 votes). Check out past polls.