Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://133743]
help
Chatterbox?
[Corion]: LanX: cmd.exe is just another way to launch Perl
[LanX]: I know its a cult... and I repent it every time
[LanX]: But cygwin comes with path problems and powershell requires too much learning for me
[LanX]: eshell in emacs is often my resort in development
[LanX]: Thx found a solution! :)
[Eily]: I wrote "your" instead of "you're" :'(
[Eily]: I guess it means that my English is good enough that I make the same mistakes as native speakers though :/

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2017-03-27 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.