in reply to Re: How do I avoid double substitution when replacing many patterns?
in thread How do I avoid double substitution when replacing many patterns?

This particular scheme fails if you allow a variable named '0' though, so you may need to do something else in the replacement part if this is the case.

Yes. In that case, your "$1||$2" would have to be "defined $1 ? $1 : $2".