in reply to Global replace issue
You're iterating over all the keys, and you're not happy that the subs associated with all of them get called. The simple solution here is to not iterate over all the keys.
You are finding it not very useful to convert units and convert them back. I'm wondering why it would be useful to convert in whichever direction in the first place instead of ending up with all metric or all Imperial. Maybe appending the conversion to the existing version would be handy, but going from a randomly mixed bag of units to having exactly the opposite measurements in the wrong units doesn't seem to be.
Perhaps you should have a metric-to-Imperial hash and an Imperial-to-metric hash, and tell the program from the command line or such which units you want to have in the end. That way you'd only convert in one direction, and only the measurements that started in the wrong units.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Global replace issue
by aquarium (Curate) on Aug 30, 2010 at 23:14 UTC |