Hi
Yesterday i have tried something like this
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 = (); m +y @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_l +ot_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<scalar(@temp_second +);$mb++) { for(my $cb = 0 ; $cb < scalar(@Res +ult_array);$cb++) { if($temp_second[$mb] eq $R +esult_array[$cb]){ $count_rep +eat++; } } } if($count_repeat eq 0){ push(@array_range,scalar(@temp_sec +ond)); print "\n MAAAAA KAAAALI".$total_second."_:"."@array_range"."_ +_##_ "."@temp_second"."\n\n"; foreach (@temp_second){push(@Resul +t_array,$_);} $insert_flag_inner = 1; last; } } } } }until($insert_flag_inner eq 1); } print "\n"."@array_range"."_::_"."@Result_array"."\n"; print "+++++++++++++++++++++\n\n"; my $loop_limit = 0; for (my $gh = 0;$gh <scalar(@array_range);$gh++){ my $disp_total = 0; for(my $ch = 0;$ch <$array_range[$gh];$ch++){ my $t_val = $Result_array[$loop_limit]; $disp_total = $disp_total+$A_services[$t_val-1]; print "$loop_limit _:: _".$t_val."_::_".$A_service +s[$t_val-1]." "; $loop_limit++; } print $disp_total."\n"; }

In reply to Re^8: Help Me in following code :: by gskoli
in thread Help Me in following code :: by gskoli

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.