my @num_weights = [36,264,188]; my @leftovers = [1,2,3,4]; my @hold_generations; my $i = 0; for(my $p = 0; $p < 1;$p++) #Go through all leftovers { my $pick = $leftovers[$p]; unshift @num_weights, $pick; #add item say Dumper(@num_weights); push @hold_generations, @num_weights; #store new array say Dumper(@hold_generations); splice @num_weights, 1, 1; #undo adding item say Dumper(@num_weights); }