in reply to Simply Too Slow Find and Replace

Since there were many answers on how to improve your regex handling, I thought perhaps a rearranging of the structure might help. This idea will be greatly affected by the size of the @pairs array; also it is just an idea and I haven't benchmarked it.
# Get a hash of your translations, for quick lookup %pair_lookup = map { chomp; split(/=/, $_, 2); } <SUBLIST>; foreach $name (<CUSTLIST>) { print NEWCUSTLIST // split the line into words and check if there // is a translation for it. If there is, return // the translation otherwise return the original join(" ", map { (defined $pair_lookup{$_}) ? $pair_lookup{$_} : $_; } split (/ /, $name, 2) ); }
Again this was just on the idea that there might be a way other than via a regex, and that it might be quicker.