for (0..$all_the_numbers) { my $number = 30 - int(rand(20)); push @all_rand, $number; # Always add to all_rand; next if $number >= 0; # Skip if number is positive push @negative_only; }