http://www.perlmonks.org?node_id=483833

webchalkboard has asked for the wisdom of the Perl Monks concerning the following question:

Hello,
I have an API which i'm trying to connect to. I can send requests in the following format.

my $set1 = { 'setting1' => $setting1, 'type' => 'Broad', 'text' => $text, 'url' => $url, }; my $set2 = { 'setting1' => $setting1, 'type' => 'Broad', 'text' => $text, 'url' => $url, }; my @setargs = [ $set1, $set2 ];

My question is how can I push those set elements onto the setargs array? Rather than explicity defining them, because i'm not sure how many I need to create.

Would code like this work?

foreach my $set (whatever loop) { push @setargs, $set; }

Thanks,
Tom

Learning without thought is labor lost; thought without learning is perilous. - Confucius
WebChalkboard.com | For the love of art...