use strict; my $path = "C:\\Dir1\\Dir2"; print "Path before change :$path:\n"; $path =~ 's/\\/\//g'; print "Path after change :$path:\n";