From: pmak@... Date: 2005-04-18T20:29:36+09:00 Subject: String<->float conversion headaches I'm programming an application that saves its data in a MySQL database. I frequently run into headaches where I get errors like: undefined method `-' for "9000.00":String (NameError) because I typed source['salary'] -= encumbered['salary'] where source[] and encumbered[] were instantiated from MysqlResult#fetch_hash, and are thus strings instead of integers or floats. I write this sort of thing all the time in Perl and don't have trouble because of its automatic type conversion. What would be the best way to do this in Ruby? Right now I'm writing: source['salary'] = source['salary'].to_f - encumbered['salary'].to_f everywhere and it feels quite tedious.