in reply to multiple files and hashed
What you want is a HoH (Hash of Hashes).
%hash = { filename1 => { id1 => 1, id2 => 1 }, filename2 => { id1 => 3, id2 => 4 } };
like this:
use strict; use warnings; #NOT TESTED my %filehash; for ($i=1; $i<=$number; $i++) { my $filename = "file$i"; open (lookup, "<$filename") or die "Can't open $filename : $!\n"; while (<lookup>) { ($ref_name, $ref_id) = (split /\t/, $_)[3,4]; $filehash{$filename}{$ref_id} = $ref_name; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: multiple files and hashed
by Anonymous Monk on Nov 06, 2006 at 16:54 UTC |