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