我有一个数组,@allinfogoals
,我想使它成为一个多维数组。在试图做到这一点,我试图把数组作为一个项目,像这样:将数组作为一个项目推送到另一个数组 - 不创建多维数组
push @allinfogoals, ($tempcomponents[0], $tempcomponents[1], $singlehometeam);
凡在阵列括号这些项目都是单独的字符串我有事先。不过,如果我引用$allinfogoals[0]
,我得到的$tempcomponents[0]
的价值,如果我尝试$allinfogoals[0][0]
我得到:
Can't use string ("val of $tempcomponents[0]") as an ARRAY ref while "strict refs" in use
我怎么能这些阵列添加到@allinfogoals
使它成为一个多维数组?
这可以解释为什么这个工程... http://perldoc.perl。组织/ perlreftut.html – squiguy