s/\Q$delim/\\$delim/g; # \E is optional at the end of the literal.