use strict; use warnings; use Roman (); my @unsorted = qw(8 11 9 4 3); *f = \&Roman::roman; my @sorted = map { $_->[0] } sort { $a->[1] cmp $b->[1] } # or <=>, or $b before $a map { [$_, f($_)] } @unsorted; print "@sorted\n"; __END__ # output shown below 3 4 9 8 11