use Path::Class; # maybe $DIR is read from a configuration file or passed in from another tool my $d = dir($DIR); $d = $d->parent->subdir("bar"); # one "right" way to do path manipulation my $p = $d=~/\/$/ ? "$d" : "$d/"; #### require File::Spec::Unix; my $x = File::Spec::Unix->catdir('foo','bar').'/';