in reply to Re: using a hash to do substitution?
in thread using a hash to do substitution?
no_slogan's regex trick is very nice (++), however, I've been led to believe that lots of ors (the | char) in a regex can blow out the stack (or take a long time) because of the back tracking required. Can any more adept monks comment on this?
The other more brute force less pretty way to solve the problem is:
foreach $key (keys %hash) { $text =~ s/$key/$hash{$key}/eg; }
-I went outside... and then I came back in!!!!
In Section
Seekers of Perl Wisdom