Thanks! In the meanwhile I tried something and it worked, I post it here in case it could be helpful to someone (or in case you have suggestions to give me on it). Here it is:
sub read_file_line { my $fh = shift; if ($fh and my $line = <$fh>) { chomp $line; return [ split(/\t/, $line) ]; } return; } #sub compute { # do something with the 2 values #} open(my $f1, $input); open(my $f2, $input_1); my $pair1 = read_file_line($f1); my $pair2 = read_file_line($f2); my $value; open OUT,">$file"; while ($pair1 and $pair2) { $value=$pair1->[3]*(1-$pair2->[3]); $pair1 = read_file_line($f1); $pair2 = read_file_line($f2); print OUT $pair1->[0]."\t".$pair1->[1]."\t".$pair1->[2]."\t".$valu +e."\n"; } close($f1); close($f2); close OUT;
Thanks, Giulia
In reply to Re^2: Read and analyze two file in parallel
by remluvr
in thread Read and analyze two file in parallel
by remluvr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |