in reply to Re: Collapsing paths
in thread Collapsing paths

It wouldn't hurt to make the loop more obvious.

1 while $path =~ s{(^|/)(\w+/\.\./|\./)}{$1};

It's even shorter.