perl 之reverse-sort

今天碰到了两个perl的排序函数 ,reverse & sort

例如:

@array = 1..10; #@array=1,2,3,4,5,6,7,8,9,10
print @array;      # print out  1,2,3,4,5,6,7,8,9,10
@b = reverse(@array);
print @b; #print out 10,9,8.......1

@c = sort(@b);
print @c; # print out 1,10,2,3,4,5.....9 此排序顺序主要依照第一个字符,如1在2前面,1在10前面

Posted in perl |

0 Comments.

Leave a Reply

[ Ctrl + Enter ]

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Get Adobe Flash playerPlugin by wpburn.com wordpress themes