My final answer for spam-folder-counting, p5 vs p6: scan +spam|perl -naE '$d{$F[1]}++; END{say "$_: $d{$_}" for sort keys %d}' scan +spam|perl6 -e "for lines.map({.words(2)[1]}).Bag.sort {.fmt('%s:%d').say}"
On the surface, very different ways of going about it. Under the hood, p6's Bag constructor replicates p5's "$d{$F[1]}++" and p6's lazy "lines", "map" means we can avoid "-n" yet still not need to slurp in the input all at once. Subjectively, they're both appealing to me in their simplicity & expressiveness. (I'd still like to see the "-a" autosplit (auto-comb?) option for p6 one-time-commands.) -y