in reply to multiple files and hashed

If I understand what you are trying to do, you probably need a single HoH (hash of hashes) structure rather than several different hashes. Something along the lines of

use strict; use warnings; my @filesThisRun = (qw{file1 file2 ... fileN); my %fileInfo = (); foreach my $file (@filesThisRun) { open my $lookupFH, q{<}, $file or die qq{open: $file: $!\n}; while (<$lookupFH>) { my ($refName, $refID) = (split m{\t})[3, 4]; $fileInfo{$file} = {$refID => $refName}; } close $lookupFH or die qq{close: $file: $!\n}; }

That gives you a hash keyed by file name with the value for each file being an anonymous hash of refID/refName pairs. If you need the count number rather than the file name as the key then increment a count each time through the foreach and use that as the key instead of the file name. To access the refName for file "file2", refID "XX" you would do

my $queryFile = q{file2}; my $queryRefID = q{XX}; my $resRefName = $fileInfo{$queryFile}->{$queryRefID};

I hope this is of use.

Cheers,

JohnGG