The closedir function closes the directory that was opened by the opendir function.
#Format #closedir (DIRHANDLE); #closedir DIRHANDLE; opendir(DIR, "..") || die "Can't open: $!\n"; @parentfiles=readdir(DIR); closedir(DIR); foreach $file ( @parentfiles ){ print "$file\n"; }