in reply to Pushing Arrays

Be careful what you mean here and whether you want an array :

my @setargs = ( $set1, $set2 );

or a reference to an array:

my $setargs_ref = [ $set1, $set2 ];

You can push onto either, as long as you refer to it properly

foreach my $set (whatever loop) { push @setargs, $set; push @{ $setargs_ref }, $set; # explicit dereference }

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Replies are listed 'Best First'.
Re^2: Pushing Arrays
by Roy Johnson (Monsignor) on Aug 15, 2005 at 13:57 UTC
    Of course, for situations like that, you don't actually need a loop. You can just
    push @setargs, whatever loop
    where whatever loop isn't a loop, but is the list (or array) being iterated over in the original code.

    Caution: Contents may have been coded under pressure.
Re^2: Pushing Arrays
by webchalkboard (Scribe) on Aug 15, 2005 at 14:41 UTC

    Hi,
    Thanks I was meaning a reference to an array, so that code helps a lot thanks,

    Tom

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