Data::Dumper expects either a scalar or reference variable (Refer: DESCRIPTION section of
Data::Dumper). You should pass it a reference to you structure. Remember to interpret $VAR1 as a reference to your structure. Using
hippo's example:
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
my @aktData = ([
{ foo => 'bar' },
{ foo => 'baz' }
]);
#print 'Array: ' . Dumper (@aktData);
print 'Array: ' . Dumper (\@aktData);
foreach my $data (@aktData) {
print 'Element: ' . Dumper ($data);
}
OUTPUT:
Array: $VAR1 = [
[
{
'foo' => 'bar'
},
{
'foo' => 'baz'
}
]
];
Element: $VAR1 = [
{
'foo' => 'bar'
},
{
'foo' => 'baz'
}
];
The Dumper output clearly shows the problem he describes.