my $cnt_sort = 1; my $cnt_sort_schwartz = 1; my @array = ( [25,1], [3,7], [1,2], [2,4], [2,2], [35,34] ); # Native my @dummy = sort{ helper($a) <=> helper($b) }@array ; # nach Schwartz my @dummy_schwartz = map{$_->[0]} sort{ $a->[1] <=> $b->[1] } map{[$_, helper_schwartz($_)]} @array; print Dumper \@dummy_schwartz; print "Anzahl der Aufrufe cnt_sort: $cnt_sort\n"; print "Anzahl der Aufrufe cnt_sort_schwartz: $cnt_sort_schwartz\n"; sub helper{ my $ref = shift; $cnt_sort++; return abs($ref->[1] - $ref->[0]); } sub helper_schwartz{ my $ref = shift; $cnt_sort_schwartz++; return abs($ref->[1] - $ref->[0]); } Anzahl der Aufrufe cnt_sort: 17 Anzahl der Aufrufe cnt_sort_schwartz: 7