in reply to Re^3: how to compare two hashes with perl?
in thread how to compare two hashes with perl?
while (<DATA>) { my @pieces = split /\s+/; my $id = $pieces[0]; my $seq = $pieces[-1]; $results{$id} = [] unless exists $results{$id}; push @{$results{$id}}, $seq; }
Actually, as perlreftut instructs, the line:
$results{$id} = [] unless exists $results{$id};
is unnecessary. I highly recommend that you read perlreftut:
$ man perlreftut
|
|---|