in reply to printing to new output files within a loop

the $$ variable is a process id, which does not change within a currently running process (i.e. execution of your code)

If you want a different file name for each iteration, you could construct one using the $i variable, as well as the $$. Don't forget to close the file after you're done!

i.e.

for my $i (0..@array1-1) { open (OUT,">$$.out$i", or die "Ooops...!"; print OUT ">$array1[$i]>$array2[$i]\n\n\n"; close OUT; }