If I want to add a simple counter to count the number of lines in the output (print statement) do you know what it correct way. I pushed one of the variables into an array and counted used the scalar as a counter. But I think there should be a better way.
while(<INPUT2>){ chomp; my @current_line = split /\t/; push (@{$file2{$current_line[1]}}, $current_line[2]); if (exists $file1{$current_line[1]} ) { my $key = $current_line[1]; foreach my $position1 (@{$file1{$key}}){ if ($current_line[1] eq $key) { if ($current_line[2] == $position1) { if ($current_line[5] ==1) { if ($current_line[14] >= 3){ print RESULTS join ("\t", $current_line[1],$current_lin +e[2],$current_line[5],$current_line[14], "***",$key, $position1), "\n +"; push (@true_positives, $current_line[1]); } } } } } } }
In reply to Re^3: Reading two files, cmp certain cols
by sesemin
in thread Reading two files, cmp certain cols
by sesemin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |