in reply to Re^2: Multiple replacements with the exception of previously made replacements.
in thread Multiple replacements with the exception of previously made replacements.

If you want to leave the s/// while be able to add hash elements, write it like this:
my %replace = (....); my $pat = join '|', map {quotemeta} keys %replace; s/($pat)/$replace{$1}/g;
Otherwise, you'll have to update the pattern in the s/// if you add a new hash element.
  • Comment on Re^3: Multiple replacements with the exception of previously made replacements.
  • Download Code

Replies are listed 'Best First'.
Re^4: Multiple replacements with the exception of previously made replacements.
by jthiel (Initiate) on Aug 17, 2009 at 15:53 UTC
    Hi JavaFan,

    did that now, my statement about leaving the s/// in my previous post wasn't exactly true, yeah.

    That's sweet, so is quotemeta.

    I'm gonna have to mess around with map a little more, the map solution in my initial post was provided by a friend of mine.

    What can I say, thanks a lot, again, greatly appreciating all replies!