in reply to Re^2: What is the meaning of this line in Perl on linux?
in thread What is the meaning of this line in Perl on linux?

Hopefully this makes it clearer:

# delimiters # | | | # v v v $localdir =~ s/\//\\/g; # ^^ ^^ # | | # search part replacement

But for regexes, I would recommend using what I suggested:

$localdir =~ s{\\}{/}g;

But as I said, using a module for this is even better:

use warnings; use strict; use Path::Class qw/foreign_file foreign_dir/; my $file = foreign_file('Win32', "..\\Hello\\World.txt"); print $file->as_foreign('Unix'), "\n"; # prints "../Hello/World.txt"

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.