更新时间:2023-11-27 09:02:52
您不需要任何东西除了数组切片之外,因此我避免为此创建一个子项。
You don't need anything beyond an array slice, so I'd avoid creating a sub just for this.
my @wanted = @array[@indices];
如果使用数组引用,则适用相同的配方:
If you're working with array references, the same recipe applies:
my @wanted = @{$array}[@$indices];