while (my $file = readdir(DIR)) { #decide whether or not this is a file the user wants ... push @files, $file; }