in reply to Dynamic sort algorithm selection
Not only that, but you can go one better. You can pass sort a reference to a subroutine. This is safer and cleaner and faster than using the name of the sub.
my $sortref = \&firstname_descending; my @order = sort $sortref keys %data;
For best results, combine this approach with a dispatch table that does your subroutine lookup.
-dlc
|
|---|