Not pretty, also you'll have to take care of -a switch, perl6 -ne 'our %d; %d{ .trim.split(/\s+/)[1] }++; END {say "$_: %d{$_}" for sort keys %d}'
31.08.2015, 17:25, "yary" <not....@gmail.com>: > Once in a while, our sysadmin tweaks something on an upstream mail server, > and asks us a few days later if our spam rate has changed. I invariably whip > up a perl5 one liner like this to get a daily spam count from my "mh" mail > folder: > > scan +spam|perl -naE '$d{$F[1]}++; END{say "$_: $d{$_}" for sort keys %d}' > > "scan +spam" spits out one line per message in my spam folder, with the date > in field 1. I'm using perl in an awk-like way, and taking advantage of > non-strictness to use a global %d without declaring it. > > What's a good concise "strict" Rakudo one-liner that works the same? In > particular, is there a Perl6 one-liner that works line-by-line (not requiring > reading all STDIN into memory) and doesn't require a variable declaration? > > -y