sort 自定义函数排序

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

sub by_number {
	if ($a > $b){1}
	elsif($a < $b){-1} else {0}
}

my @number = (1,4,76,42,35,51,3,5);

my @result = sort by_number @number;
print "@result";
print "\n";

foreach (@result){
	print "$_ \t";
}