perl_n00b has asked for the wisdom of the Perl Monks concerning the following question:
andG_00160 F_02571 G_00161 F_01082 G_00162 F_00034 G_00163 F_00035 G_00164 F_00036
F_00013 G_06670 F_00034 G_00162 F_00035 G_00163 F_00036 G_00164 F_00038 G_00165
open $IN1, "<", $infile1 or die "cannot open $infile1: $!\n"; open $IN2, "<", $infile2 or die "cannot open $infile2: $!\n"; open $OUT, ">", $outfile or die "cannot open $outfile: $!\n"; my(@UR_CI) = <$IN1>; my(@CI_UR) = <$IN2>; my(%UR_CI, %CI_UR); foreach my $seq (@UR_CI) { if ($seq =~ /^(\w+)\s+(\w+)$/) { $UR_CI{"$1"} = "$2"; } } foreach my $seq (@CI_UR) { if ($seq =~ /^(\w+)\s+(\w+)$/) { $CI_UR{"$2"} = "$1"; } } foreach my $key1 (keys %UR_CI) { foreach my $key2 (keys %CI_UR) { foreach my $value1 (values %UR_CI) { foreach my $value2 (values %CI_UR) { if (($UR_CI{$key1} eq $CI_UR{$key2}) && ($UR_CI{$value1} ne $CI_UR{ +$value2})) { delete $UR_CI{$key1}; } } } } } while ( my ($key, $value) = each(%UR_CI) ) { print $OUT "$key => $value\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash Comparisions
by GrandFather (Saint) on Nov 23, 2009 at 10:29 UTC | |
|
Re: Hash Comparisions
by Khen1950fx (Canon) on Nov 23, 2009 at 08:31 UTC | |
|
Re: Hash Comparisions
by grizzley (Chaplain) on Nov 23, 2009 at 08:36 UTC | |
|
Re: Hash Comparisions
by vitoco (Hermit) on Nov 23, 2009 at 12:21 UTC | |
by Anonymous Monk on Nov 23, 2009 at 18:05 UTC |