my $path-info = $ENV{PATH_INFO} my $path = "/home/usrs/rjoseph/images"; $path-info =~ s/^[^/]// # strip of preceeding noise $path-info =~ s#[^/\w\.]//g # strip out any non-word dot chars #### my $file_path = "$path/$path-info"; if ( -s $file_path ) { open(FILE, $file_path) or die ... #### foreach my $file ( @image_list ) { $file =~ s#$path##; # remove the physical path part my $file_name = $file; $file_name = s/\.\w+$//; # strip off extension print "Image: $file_name"; }