Perl - 代码未按预期执行

Perl - Code not executing as expected

我有以下脚本

print ("\n\n=========================================\n");

@array = (1,2,"Hello");

print("$array[0] = $array[0]\n");
print("$array[1] = $array[1]\n");
print("$array[2] = $array[2]\n");
@array =(a..z);
**print("\@array[5..10]=@array(5,3..10,24");**
@lenght=@array;
print "The lenght of\@array is:@lenght\n";


print ("=========================================\n\n");. 

标有双 ** 是我没有得到预期的输出。请帮我解决这个问题。

我期望的输出是这样的 d,e,f,h,k 是这样的

如果您希望打印出特定的数组元素和整个数组的长度,请使用如下内容:

@array = ('a'..'z');
$newarray = @array[0,5..10];
print("\@array[0,5..10] = @array[0,5..10]\n");
$length = @array;
print "The length of \@array is $length\n";

其输出为:

@array[0,5..10] = a f g h i j k
The length of @array is 26