sort { print "A: $a\nB: $b\n> "; { A => -1, B => 1 }->{uc substr <>, 0, 1} } @foo;