#! /usr/bin/perl use Data::Dumper; my $sort_func = sub { $a <=> $b }; my @to_be_sorted = (1,2,3); my @new = sort ($sort_func, @to_be_sorted); print Dumper \@new; #### $VAR1 = [ 1, 2, 3, sub { "DUMMY" } ];