##
#remove .
while ( $path =~ s#/\./#/# ) {;}
#remove ..
while ( $path =~ s#/[^/]+?/\.\./#/# ) {;}
####
while ( $path =~ s#(/[^/]+)?/\.(\.)?/defined($2) ? "/" : "$1/"/e ) {;}
####
unless ( chdir $path ) {
die "Couldn't there ($path) from here\n";
}
return `pwd`;