perl -wle '$_ = "... \\ ..."; s/\\/$\\backslash$/; print' Final $ should be \$ or $name at -e line 3, within string syntax error at -e line 3, near "s/\\/$\\backslash$/" Execution of -e aborted due to compilation errors.