use File::Spec; my $dir=File::Spec->catdir('//server','share','folder','subfolder'); #### chdir $dir or die "Cannot change to $dir. $!";