#!/usr/bin/perl use strict; use warnings; use URI; my $base_uri = URI->new( '/home/httpd/project/' ); while (my $path = ) { chomp($path); my $absolute = URI->new_abs( $path, $base_uri ); printf "%s + %s: %s\n", $base_uri->canonical, $path, $absolute->canonical; } __DATA__ ../another/ subdir/ ../../../etc/very/dangerous ../project/