On Aug 27, 2007, at 1:29 PM, Chas Owens wrote:

Bad idea*, at least until Perl 5.10 (and maybe not even then).

Well, it may or may not be a bad idea.

On the one hand that performance penalty may be negligible for the OP problem and thus it just does not matter. On the other hand your solution assumes you can loop through the keys and perform global substitutions, working on the last modified string in each iteration.

Assuming you don't want higher-order substitutions (so to speak) which is suggested by the fact that the OP worked in a list of keys in an unkown order, that solutions needs there are no possible clashes between values and keys. And I think you don't need to go to the trouble of checking that or even depend on that, the OR-based solution is robust to that automatically.

-- fxn


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to