- or download this
# NOTE: I have already prepended pwd if needed
...
$path =~ s#/[^/]+?/\.\.#/#;
}
- or download this
#remove .
while ( $path =~ s#/\./#/# ) {;}
#remove ..
while ( $path =~ s#/[^/]+?/\.\./#/# ) {;}
- or download this
while ( $path =~ s#(/[^/]+)?/\.(\.)?/defined($2) ? "/" : "$1/"/e ) {;}
- or download this
unless ( chdir $path ) {
die "Couldn't there ($path) from here\n";
}
return `pwd`;