Then you need to swap the part that is searched with the part that is replaced.
Currently, as haukex already explained, you have:
# delimiters # | | | # v v v $localdir =~ s/\//\\/g; # ^^ ^^ # | | # search part replacement
So, if you swap search part and replacement, you get:
# delimiters # | | | # v v v $localdir =~ s/\\/\//g; # ^^ ^^ # | | # search part replacement
The above gets much clearer if you use another delimiter instead of s///g, for example, s{}{}g. Then your original line is
# delimiters # | || | # v vv v $localdir =~ s{/}{\\}g; # ^ ^^ # | | # search part replacement
With the swap of search part and replacement part, that becomes:
<c> # delimiters # | || | # v vv v $localdir =~ s{\\}{/}g; # ^^ ^ # | | # search part replacement
In reply to Re^7: What is the meaning of this line in Perl on linux?
by Corion
in thread What is the meaning of this line in Perl on linux?
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |