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