my $dir = "start"; foreach my $file (@files) { my $path = "$dir/$file"; open FILE, $path or die "Can't open file '$path': $!"; while () { print $_; } } #### use Cwd; my $thisdir = getcwd; print "Content-type: text/html\n\n"; print "Current directory = $thisdir\n";