in reply to Re^4: Variables loop in Parallel::ForkManager
in thread Variables loop in Parallel::ForkManager

The following might help. I don't understand why you are forking, so I have not done so, but you could add forking inside the loop if you want to, as long as you increment and reset $index_y in the main process so that it is coordinated across all the child processes.

#!/usr/bin/perl use strict; use warnings; open(my $y, "<", "y") or die "y: $!"; my @y = <$y>; close($y); my $index_y = 0; open(my $x, "<", "x") or die "x: $!"; foreach (<$x>) { chomp; open(my $output, ">", "$_") or die "$_: $!"; print $output "$_$y[$index_y]"; close($output); $index_y++; $index_y = 0 if($index_y > $#y); } close($x);