in reply to sort in arbitrary order with subroutine, syntax error
Just use the BLOCK form, and everything will work: sort {by_seq([qw(five nine one seven three)])} keys %h