my @array1 = (2, 3, 4, 5, 2, 7, 3, 8 ,9, 1, 3 ,5 ,7, 8, 9, 1, 2, 3, 4, 5, 2, 7, 3, 8 ,9, 1, 3 ,5 ,7, 8, 9, 1); for(my $int = 0; $int < scalar(@array1); $int=$int+5) { splice @array1, $int, 1, int(rand(9999)); } print @array1;