Adding to the ?above —
A generic solution must escape the escape character also, otherwise the transformation isn't reversible.
{ my %T = ("\n" => "\\n", "\r" => "\\r", "\\" => "\\\\"); sub escape { s/[\r\n\\]/$T{$&}/g for @_ } }
In reply to Re: Transforming "\r\n" to '\012\015'
by Anonymous Monk
in thread Transforming "\r\n" to '\012\015'
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |