opendir DIR, "$dir"; my @arr = grep -f, grep /\.jpg$/i, map "$dir/$_", readdir DIR; #### my @arr = glob("*.jpg");