'Why an array of array preserves my initial array?
So I have this fragment of code:
push @{$savedcallouts[-1]}, {
$funcnm => {
matches => {%$captures},
flags => [eval { @flags}]
}};
print Dumper \@{$savedcallouts[-1]};
Which gives the following result:
$VAR1 = [
[
{
'normalexpr' => undef
},
{
'normalexpr' => undef
},
{
'ternaryexpr' => undef
}
]
];
But if I remove the square brackets of flags => [eval { @flags}] (i.e. have flags => eval { @flags} - I get this:
$VAR1 = {
'begin_binary' => {
'HASH(0x1038301c0)' => {
'ternaryexpr' => undef
},
'flags' => {
'normalexpr' => undef
},
'matches' => {}
}
};
Any ideas why is this happening and how can I potentially avoid - i.e. have the array as hash field directly without artifacts or being an nested array.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
