my @only_unique = (); my $index1 = scalar(@new_lot)+1; #my $total_first = 0; my @array_range = (); my @temp_first = (); my @Result_array =(); my @new_lot_dup = @new_lot; my $insert_flag = 0; do { my $total_first = 0; my @temp_first = (); my @array_range = (); my @Result_array =(); for(my $ab = 0;$ab <6 ;$ab++){ my $random_one = int(rand(@new_lot_dup)); if($random_one eq 0){$random_one = int(rand(@new_lot_dup));} print $random_one."_::_".$A_services[$random_one-1]."\n"; $total_first = $total_first+ $A_services[$random_one-1]; push(@temp_first,$random_one); if(($ab >2) &&($ab<6) ){ if(($total_first gt 840) && ($total_first lt 900)){ push(@array_range,scalar(@temp_first)); print "\n".$total_first."_:"."@array_range".":_ "."@temp_first"."\n\n"; foreach (@temp_first){push(@Result_array,$_);} $insert_flag = 1; last; } } } } until($insert_flag eq 1); my$one = 0; do{ $one++; &Get_Other_Group(); } until($one eq $index1); sub Get_Other_Group() { my $insert_flag_inner = 0; do{ my $total_second = 0; my @temp_second = (); for(my $vb = 0;$vb<6;$vb++) { my $random_two = int(rand(@new_lot_dup)); if($random_two eq 0){$random_two = int(rand(@new_lot_dup));} #print $vb."IN FUNCTION ::".$random_two."_::_".$A_services[$random_two-1]."\n"; $total_second = $total_second+ $A_services[$random_two-1]; push(@temp_second,$random_two); ##### __ This is to Delete Duplicate Entry___# #undef %saw; #@temp_second = grep(!$saw{$_}++, @temp_second); if(($vb >2) &&($vb<6) ) { print $vb."_::_ "; if(($total_second gt 840) && ($total_second lt 900)) { my $count_repeat = 0; print $total_second."****"."@temp_second"."\n"; for(my $mb = 0;$mb