--------------020503000008070704030306
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I'm new to ruby so this was quite a fun little thing to help me get up 
to speed on what you can do with the language.

since this quite small and simple I've attached it.

thanks
jason

--------------020503000008070704030306
Content-Type: text/plain;
 name
onvert.rb" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename
onvert.rb" #!/usr/bin/env ruby @data ["M" , 1000], ["CM" , 900], ["D" , 500], ["CD" , 400], ["C" , 100], ["XC" , 90], ["L" , 50], ["XL" , 40], ["X" , 10], ["IX" , 9], ["V" , 5], ["IV" , 4], ["I" , 1] ] @roman r{^[CDILMVX]*$} @arabic r{^[0-9]*$} def toRoman(num) reply " for key, value in @data count, num um.divmod(value) reply << (key * count) end reply end def toArabic(rom) reply for key, value in @data while rom.index(key) 0 reply + alue rom.slice!(key) end end reply end $stdin.each do |line| case line when @roman puts toArabic(line) when @arabic puts toRoman(line.to_i) end end --------------020503000008070704030306--