in reply to Re^2: how to loop through hash tables more efficiently
in thread updated_again: how to loop through hash tables more efficiently
Ah! Then the following should work:
use strict; use warnings; use File::Slurp qw/read_file/; my ( $hash1, $hash2 ) = @ARGV or die $!; my %hash1 = map { /(.+?),(.+)/; $1 => $2 } grep /.,./, read_file $hash +1; my %hash2 = map { /(.+?),(.+)/; $1 => $2 } grep /.,./, read_file $hash +2; for my $key2 ( sort keys %hash2 ) { for my $key1 ( sort keys %hash1 ) { print "$key2\t$hash2{$key2}\t$key1\n" if $hash1{$key1} =~ /\b$ +hash2{$key2}\b/; } }
|
|---|