my @all_matches = glob "*.txt"; my @files = grep {-f} @all_matches;