Syntactic Confectionery Delight | |
PerlMonks |
Re: replacing pipe "|"by SarahM (Monk) |
on Mar 26, 2003 at 20:38 UTC ( [id://246071]=note: print w/replies, xml ) | Need Help?? |
That's because the | is a special character, and you need to escape it. change $rem ="|"; to $rem ="\\|"; and it'll work. Another (cleaner/easier) option is to use \Q and \E (they escape the characters for you). So change s/$rem/$rep/go; to s/\Q$rem\E/$rep/go;
In Section
Seekers of Perl Wisdom
|
|