[ Thanks to Mike
Golvach for this link. ]
“Q. Why the klunky foreach block at the top of the
attached code? Shouldn’t sorting be simpler?“A. Actually, sorting data is simpler, but, in this case we were
dealing with sorting on two levels, which may not have been readily
apparent. The @s_perms array that gets returned from the public
domain “permute” subroutine actually contains multiple scalar
pseudo-lists.””