in reply to interpolation in replacement part

Put brackets around the hash element to explicitly interpolate:

$instr =~ s|$pat|${patt1{$pat}}|egs;

Update: sorry, brainfreeze, this will not work

2nd Update:This node is getting upvoted even though I marked it as wrong, so I thought I'd clarify:This advice is wrong and won't work, please don't use it, it was conceived and written in an inexplicable moment of fuzzy-headedness. runrig's solution below works perfectly.

Replies are listed 'Best First'.
Re^2: interpolation in replacement part
by anniyan (Monk) on Oct 14, 2005 at 16:08 UTC

    Sorry to say, it is not working.

    Regards,
    Anniyan
    (CREATED in HELL by DEVIL to s|EVILS|GOODS|g in WORLD)