sub remove_dot_dot_frodo72 { my $path = File::Spec::Unix->canonpath($_[0]); my @true; /^\.\./ && @true ? pop(@true) : push(@true, $_) # <- Added to cond foreach File::Spec::Unix->splitdir($path); $path = File::Spec::Unix->catdir(@true); return length($path) ? $path : '.'; # <- Added. }