@numfiles = grep { /^\.txt/ && -f "$directory/$_" } readdir(DIR);