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