will work, where $var can be given either the name of the subroutine or a reference to it. If validation of the sub name is necessary, it ought to be done separately from the call to sort.$var = 'by_title'; # or $var = \&by_title; sort $var @array;
In reply to Re^2: Sort by what?
by Roy Johnson
in thread Sort by what?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |