use warnings;
my @a = (1, 11, 3, 5, 21, 9, 10);
my @b = sort @a;
print "@b";
Run Code Online (Sandbox Code Playgroud)
产量:1 10 11 21 3 5 9
键盘链接:http://codepad.org/Fvhcf3eP
我猜sort函数没有将数组的元素作为整数.这就是为什么输出不是:
1 3 5 9 10 11 21
是吗?
如何将上述结果作为输出?
perl ×1