my $sort_func = sub { $a <=> $b }; sort $sort_func @to_be_sorted; # Sort 1 sort ($sort_func, @to_be_sorted); # Sort 2