当我想将输入文件分配给数组时,出现此错误。
while (<>) {
my @tmp = split;
push my @arr,[@tmp];
print "@arr\n";
}
output: ARRAY(0x7f0b00)
ARRAY(0x7fb2f0)
Run Code Online (Sandbox Code Playgroud)
如果我更改[为,(那么我将获得所需的输出。
while (<>) {
my @tmp = split;
push my @arr,(@tmp);
print "@arr\n";
output: hello, testing the perl
check the arrays.
Run Code Online (Sandbox Code Playgroud)
(@tmp)和之间的区别是什么[@tmp]?