Hi Thanks.Below is the code i tried but it does not print anything to the STDOUT.
#!usr/bin/perl use strict; use warnings; my ($infile1,$infile2) = @ARGV; open (IFILE1, "<", $infile1) || die "Cannot open $infile1 +:$!\n"; open (IFILE2, "<", $infile2) || die "Cannot open $infile2:$!\n"; my @array1; my %hash1; my $str; while (<IFILE1>) { @array1 = split (" ", $_); $str = $array1[0]."\t".$array1[1]."\t".$array1[2]; $hash1{$str} = 1; } close IFILE1; my @array2; my $string; while (<IFILE2>) { @array2 = split (" ", $_); $string = $array2[0]."\t".$array2[3]."\t".$array2[4]; #print "$string\n"; if (exists($hash1{$string})) { print "$string\n"; } } close IFILE2;
In reply to Re^5: Compare three columns of one file with three columns of another file in perl
by anonym
in thread Compare three columns of one file with three columns of another file in perl
by anonym
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |