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...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Pushing Arrays
by xdg (Monsignor) on Aug 15, 2005 at 13:00 UTC | |
by Roy Johnson (Monsignor) on Aug 15, 2005 at 13:57 UTC | |
by webchalkboard (Scribe) on Aug 15, 2005 at 14:41 UTC | |
Re: Pushing Arrays
by ysth (Canon) on Aug 15, 2005 at 13:57 UTC | |
Re: Pushing Arrays
by Roger (Parson) on Aug 15, 2005 at 13:28 UTC |
Back to
Seekers of Perl Wisdom