如何调用数组的元素作为它们的索引数值

How do I call elements of an array as their index numerical value

我有一个由不同长度的字符串组成的@ORF 数组。我想去掉少于 50 个字符的字符串,所以我写了下面的 foreach 循环:

foreach (@ORF) {   
    if (length ($_) <= 50) {
            splice @ORF, ;
}

我想知道 splice 的第二个参数应该是什么,我已经用谷歌搜索了,但找不到将元素作为数值调用的方法。

你最好使用grep:

@ORF = grep{ length($_) > 50 } @ORF;