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