The code had still some bugs. Now it works.
#!/usr/bin/perl @array_a = (66.93, 66.91, 66.84, 66.82, 66.87, 66.91, 66.7, 66.8, 66.5 +7, 66.61, 66.81, 66.72, 66.78, 66.76, 66.86, 66.73, 66.82, 66.95, 66. +88, 66.85, 66.87, 66.75, 66.88, 66.93, 66.94, 66.87, 66.88, 66.85, 66 +.83, 66.89, 66.96, 67.03, 67.08, 67.22, 67.36, 67.55, 67.5, 67.49, 67 +.38, 67.49, 67.47, 67.7, 67.62, 67.58, 67.61, 67.79, 67.73, 67.79, 67 +.81, 67.94, 67.99, 68.18, 68.01, 67.82, 67.71, 67.71, 67.65, 67.69, 6 +7.7, 67.7, 67.69, 67.66, 67.62, 67.58, 67.56, 67.5, 67.24, 67.36, 67. +45, 67.46, 67.38, 67.55, 67.53, 67.56, 67.67, 67.78, 67.78, 67.78, 67 +.78, 67.84, 67.78, 67.74, 67.9, 67.72, 67.74, 67.79, 67.86, 67.88, 67 +.93, 67.97, 68.09, 67.76, 67.89, 67.81, 67.97, 68, 67.84, 67.95, 67.9 +7, 68.02, 68.07, 68.03, 68.08, 68.05, 68.05, 68.07, 68.14, 68.18, 68. +21, 68.13, 68.07, 68.02, 68, 67.96); @array_b = (10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9 +, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, +10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8 +, 8, 8, 8, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7 +, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, +10, ); my ($array_ref_c, $array_ref_d, $array_ref_e) = subroutine(\@array_a,\ +@array_b); my @array_c = @$array_ref_c; my @array_d = @$array_ref_d; my @array_e = @$array_ref_e; foreach my $i (0 .. $#array_a) { print($i, "\t",$array_b[$i],"\t",$array_a[$i],"\t",$array_c[$i],"\t" +,$array_d[$i],"\t",$array_e[$i],"\n"); } sub subroutine { my ($listaref, $listbref) = @_; my (@array_a) = @$listaref; my (@array_b) = @$listbref; foreach my $i (10 .. $#array_a) { $array_c[$i] = 0; $array_d[$i] = 0; $array_e[$i] = 0; if (( $array_b[$i] >= 5 ) && ( $array_b[$i] < 7 )) { for ( $l = 0 ; $l < $array_b[$i] ; $l++ ) { $array_c[$i] = $array_c[$i] + $array_a[$i - $l]; } $array_c[$i] = $array_c[$i] / $array_b[$i]; } if (( $array_b[$i] >= 7 ) && ( $array_b[$i] < 9 )) { for ( $l = 0 ; $l < $array_b[$i] ; $l++ ) { $array_d[$i]= $array_d[$i] + $array_a[$i - $l]; } $array_d[$i] = $array_d[$i] / $array_b[$i]; } if (( $array_b[$i] >= 9 ) && ( $array_b[$i] < 15 )) { for ( $l = 0 ; $l < $array_b[$i] ; $l++ ) { $array_e[$i]= $array_e[$i] + $array_a[$i - $l]; } $array_e[$i] = $array_e[$i] / $array_b[$i]; } #print($i, "\t",$array_b[$i],"\t",$array_a[$i],"\t",$array_c[$i],"\t +",$array_d[$i],"\t",$array_e[$i],"\n"); } return (\@array_c, \@array_d, \@array_e); } __END__

In reply to Re^9: Parallel::ForkManager is time consuming...takes too long by esolkc
in thread Parallel::ForkManager is time consuming...takes too long by esolkc

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.