Hi Everyone,
Any simple code can simplify the code below, please advice. Thanks
[root@]# cat 2.pl
#!/usr/bin/perl
use warnings;
use strict;
my @aaaaa = <DATA>;
my @uids;
foreach (@aaaaa) {
my @ccccc = split (",", $_);
push @uids, $ccccc[2];
}
sub by_uids {
$uids[$a] <=> $uids[$b];
}
print @aaaaa[sort (by_uids (0..$#aaaaa))];
__DATA__
1,test,34
1,test2,65
2,test,35,
1,test3,34
2,test,34
[root@]# ./2.pl
1,test,34
1,test3,34
2,test,34
2,test,35,
1,test2,65
[root@]#