Given a path actually exists, problem with a solution not actually changing directories is specified in File::Spec/METHODS ...
- canonpath
No physical check on the filesystem, but a logical cleanup of a path.
$cpath = File::Spec->canonpath( $path ) ;Note that this does *not* collapse x/../y sections into y. This is by design. If /foo on your system is a symlink to /bar/baz, then /foo/../quux is actually /bar/quux, not /quux as a naive ../-removal would give you. If you want to do this kind of processing, you probably want "Cwd"'s "realpath()" function to actually traverse the filesystem cleaning up paths like this.
Otherwise, OP should test|improve on AnomalousMonk's and/or graff's solutions.
In reply to Re^3: 2 substitution problems
by parv
in thread Yet another substitution problem
by Amphiaraus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |