opendir (DIR, $dir) or die "cannot opendir $dir"; my @files = readdir(DIR); closedir (DIR);