in reply to Re^2: Collapsing paths
in thread Collapsing paths

Depends on your system.
use File::Spec; print File::Spec->canonpath("foo/../bar/../baz/")."\n";
\baz

On system without symlinks, canonpath collapses x/../y (although not always correctly, as shown above).

Update: Technically, NTFS does have symlinks, but most software act as if they don't exist, including File::Spec.