in reply to Minimizing paths?

I did something similar for creating absolute paths for use in redirects. Here's the code:
sub absolute_url ($$) { my ($base,$url) = @_; $base =~ s{/[^/]*$}{/}; # remove file from base $url = $base.$url; # append base and url 1 while ( $url =~ s{/[^/]*/\.\./}{/} ); # remove .. return $url; # all done! }