Consider...
for %addrbook.classify({ .value.substr(0,1).uc }).sort -> $g {
say "{$g.key}:";
.say for $g.value».invert».fmt(" %-32s %s");
}
So, the outer loop iterates over the sorted pairs, passing each to $g in the block.
(
"A" => ["allison\@parrot.org" => "Allison Randal",
"audreyt\@audreyt.org" => "Audrey Tang"],
"J" => ["jnthn\@jnthn.net" => "Jonathan Worthington",
"jesse\@fsck.org" => "Jesse Vincent"],
"L" => ["larry\@wall.org" => "Larry Wall"],
"P" => ["pmichaud\@pobox.com" => "Patrick R. Michaud"]
)
The say "{$g.key}:" line outputs the group letter and colon.