【发布时间】:2011-12-09 17:53:00
【问题描述】:
这是脚本
use strict;
sub sortF {
my $l1 = hex ${@$a}[0];
my $l2 = hex ${@$b}[0];
return $l1 <=> $l2;
}
my @results;
my @parsedLine = ['0x1a',"hello"];
push(@results, @parsedLine);
my @parsedLine2 = ['0x1b',"ohello"];
push(@results, @parsedLine2);
my @sortedresults = sort(sortF(@results));
我想通过列表元素指向的匿名数组的第一个元素对列表@results 进行排序
这给出了错误
Can't use string ("0") as an ARRAY ref while "strict refs" in use at ...
sortF函数应该怎么写?
【问题讨论】: