alarm__ignore
执行以下 foreach 循环时,我不断收到“ ”信号。奇怪的是,错误出现在循环的不同迭代中(即,有时是第三次,有时是第 26 次等),我无法确定它何时发生的任何押韵或原因。当我注释掉“ my @cols = split(/\s+/, $line)
,”时,此脚本运行没有错误,但我无法弄清楚为什么拆分会导致信号。
这是代码:
my @forest = ();
foreach (@treeBlobs) {
my @treeBlob = @{$_};
my $thisTree = eval {
my %tree = ();
foreach my $line (@treeBlob) {
my @cols = split(/\s+/, $line);
$tree{id++} = {map{$CLASSIFIER_COLUMNS[$_] => $cols[$_]}(0..scalar @cols-1)};
}
return \%tree;
};
print "ERROR: $@\n" if $@;
push @forest, $thisTree;
my $sc = scalar @forest;
print "FOREST: $sc; $thisTree\n";
}
这是一些示例输出:
...
FOREST: 19; HASH(0x4668c90)
FOREST: 20; HASH(0x4664e10)
FOREST: 21; HASH(0x4658e30)
FOREST: 22; HASH(0x465ca80)
FOREST: 23; HASH(0x4664860)
FOREST: 24; HASH(0x4664240)
FOREST: 25; HASH(0x46740b0)
FOREST: 26; HASH(0x4667a70)
FOREST: 27; HASH(0x465cf50)
FOREST: 28; HASH(0x465cfd0)
ERROR: __alarm__ignore__(54)
FOREST: 29;
FOREST: 30; HASH(0x465ada0)
同样,错误并不总是(甚至通常)发生在循环的第 29 次迭代中——它可能发生在任何迭代中。
想法?
谢谢!