#!/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/ #### use URI::file; my $base_uri = URI::file->new( URI::file->cwd ); while (my $path = ) { chomp($path); my $absolute = URI::file->new_abs( $path, $base_uri ); printf "%s + %s: %s\n", $base_uri->canonical, $path, $absolute->file; } __DATA__ ../another/ subdir/ ../../../some/other/place ../project/