문제

After introducing:

use strict;

My 2-dimensional array do not work any more, and I find no description and no example in the documentation how to predeclare them. So, what have I to do?

도움이 되었습니까?

해결책 2

You declare it in just the same way you would a 1D array:

use strict;
use warnings;

my @AoA =  ( ['a', 'b'], ['foo', 'bar'] );

print Dumper \@AoA;

$VAR1 = [
          [
            'a',
            'b'
          ],
          [
            'foo',
            'bar'
          ]
        ];

다른 팁

It's impossible to give much useful help from the details that you give. Just including the text of the error message would have been useful.

In general, when you have an error that you don't understand, it's a good idea to add use diagnostics to your code. That will give you longer explanations of any errors and warnings that are generated.

(But that should be seen as a development tool - you shouldn't leave it in the code when it goes into production.)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top