标签: arrays perl sorting reference
我知道自从Perl 5.8.4开始,就可以使用以下方法进行有效的数组排序:
@a = sort @a;
详见Sort Perl array in place?
但是,可以同样(并且有效!)对数组引用进行排序吗?
@$a = sort @$a; # makes me think there would be duplication and inefficiency $a = [sort @$a]; # Looks similarly nuts!
有什么想法吗?