in reply to Re: Cleaning up a pathin thread Cleaning up a path
1while s#[^/]+/..(/|$)## [download]
aye, works great (if you canonise first)
sub remove_dot_dot_roy_edited { local $_ = $_[0]; $_ = File::Spec::Unix->canonpath($_); 1while s#[^/]+/..(/|$)##; return length($_) ? $_ : '.'; } [download]