Because | is a special character to regular expressions (which the left hand side of a substitution is). Read quotemeta (and probably perlretut and perlre as they also cover this).
In reply to Re: Problem with String replace in file
by Fletch
in thread Problem with String replace in file
by philosophia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |