C
ccc31807
This is probably a real stupid question, but it's late and I'm running
behind, and quite frankly have run out of mental energy.
I have an array with about 5,000 elements that looks like this:
0002793 0005095 0093350 0134143 0145740 0146854 0150248 0151827
0156424 0161321 0186959 0198460 0218115
I have a four level hash that looks like this:
$hash{$s}{$l}{$h}{$id} = $terms
This has contains about 8,000 discrete elements.
The $id key in the hash either matches an array element or it does
not. I need to write the hash keys and the values to one file if the
$id matches the array element. I need to write the unmatching array
elements to a second file, and the unmatching hash elements to a third
file.
Here's what I'm trying to do:
foreach my $sid (@array)
{
if ($sid == ???)
{
print FIRST qq($s $l $h $id $hash{$s}{$l}{$h}{$id}\n);
delete $hash{$s}{$l}{$h}{$id};
shift @array;
}
}
foreach (@array) { print SECOND qq{$_\n); }
Then, print the remaining hash elements to THIRD
I'm sorry, but for the life of me I can't figure out how to access the
last level of the hash, at least without iterating through the hash.
CC.
behind, and quite frankly have run out of mental energy.
I have an array with about 5,000 elements that looks like this:
0002793 0005095 0093350 0134143 0145740 0146854 0150248 0151827
0156424 0161321 0186959 0198460 0218115
I have a four level hash that looks like this:
$hash{$s}{$l}{$h}{$id} = $terms
This has contains about 8,000 discrete elements.
The $id key in the hash either matches an array element or it does
not. I need to write the hash keys and the values to one file if the
$id matches the array element. I need to write the unmatching array
elements to a second file, and the unmatching hash elements to a third
file.
Here's what I'm trying to do:
foreach my $sid (@array)
{
if ($sid == ???)
{
print FIRST qq($s $l $h $id $hash{$s}{$l}{$h}{$id}\n);
delete $hash{$s}{$l}{$h}{$id};
shift @array;
}
}
foreach (@array) { print SECOND qq{$_\n); }
Then, print the remaining hash elements to THIRD
I'm sorry, but for the life of me I can't figure out how to access the
last level of the hash, at least without iterating through the hash.
CC.