my @folder=(); opendir (DIR,"/Users/Maxi/Desktop/Verzeichnis\ beispiel") or die " the directory couldnīt be opened\n"; while (@folder = readdir(DIR)){ last; } foreach my $file (@folder){ open( FIL ,'<', $file) or die "the file $file couldnīt be opened: $!\n"; #### here something else to do with each file#### }