in reply to Re: Collapsing pathsin thread Collapsing paths
It wouldn't hurt to make the loop more obvious.
1 while $path =~ s{(^|/)(\w+/\.\./|\./)}{$1}; [download]
It's even shorter.