#!/usr/bin/perl use File::Spec; print File::Spec->canonpath("foo/../bar/../baz/")."\n"; #### foo/../bar/../baz