http://qs1969.pair.com?node_id=473878


in reply to regex & variable substitution

s/&([^;]+);?/"&#".exists $lookup{$1} ? $lookup{$1} : $1.";"/e; should work the way you want it?!

Replies are listed 'Best First'.
Re^2: regex & variable substitution
by kiz (Monk) on Jul 11, 2005 at 09:37 UTC
    Hmmm... I'm sure I tried this too... definitely better that I was getting, but still not right: I get the value inserted if the key exists, but the match is not left in place if there is no key in the hash. Also, I'm not getting the bracketing text.. Still, I'm further that I was! :-)


    -- Ian Stuart
    A man depriving some poor village, somewhere, of a first-class idiot.