my @found = grep { -f && /\.pl/ } @array; #### my @files = grep { -f && /^parsed.*\.txt$/ } map { "$dir/$_" } readdir($dh);