Ok, so here's the entire structure I'm trying to create. I need to create an anonymous array that I can use as a hash value. This works in my program:
$result = {
count, 2,
elementList, [
{name => "John Doe", age => 23},
{name => "Jane Doe", age => 24}
]
};
I'm trying to create the exact same thing with code like this. This works:
my @elements = [
{name => "John Doe", age => 23},
{name => "Jane Doe", age => 24}
];
$result = {
count, 2,
elementList, @elements
};
But this does NOT work:
my @elements;
push(@elements, {name => "John Doe", age => 23});
push(@elements, {name => "Jane Doe", age => 24});
$result = {
count, 2,
elementList, @elements
};