my $sort_sub = make_sort_sub( @sub_references ); my @sorted = sort { $sort_sub->() } @stuff;