in reply to Re^2: Reading two files, cmp certain cols
in thread Reading two files, cmp certain cols
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]); } } } } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Reading two files, cmp certain cols
by jethro (Monsignor) on Sep 19, 2008 at 23:39 UTC | |
by sesemin (Beadle) on Sep 20, 2008 at 20:36 UTC | |
by jethro (Monsignor) on Sep 21, 2008 at 00:50 UTC |