C
cousin_bubba
Hello,
I am a newbie with perl so please exuse me if this is a dumb question.
In my script I have a hash of hashes and the values of the internal
hashes are lists or arrays. I need to access all of the elements of
these arrays for comparison.
The hash of hashes looks like this:
%line_sec = (
one => (
WXYZ => ["ABCD", "EFGH"],
TUVW => ["TEFH", "LPCD"],
),
two => (
DVDC => ["GHIJ", "ELFO"],
LMNO => ["PQRS", "TUVW"],
)
);
Basically I want to cycle through all of the four letter accronyms to
see if they match a current value called $current_acc. The numbers
"one" "two" etc are command line arguments. The $head_acc variable is
the key of the inner hashes. I have tried the following but it
doesn't work:
foreach $match (@{$line_sec{$ARGV[0]}}{$head_acc})
{
if ($match eq $current_acc)
{
...
}
}
The array I would like to obtain for the case of "one" and "WXYZ" for
instance would be (GHIH ELFO).
Is there a way I can do this?
Thanks in advance for your help.
I am a newbie with perl so please exuse me if this is a dumb question.
In my script I have a hash of hashes and the values of the internal
hashes are lists or arrays. I need to access all of the elements of
these arrays for comparison.
The hash of hashes looks like this:
%line_sec = (
one => (
WXYZ => ["ABCD", "EFGH"],
TUVW => ["TEFH", "LPCD"],
),
two => (
DVDC => ["GHIJ", "ELFO"],
LMNO => ["PQRS", "TUVW"],
)
);
Basically I want to cycle through all of the four letter accronyms to
see if they match a current value called $current_acc. The numbers
"one" "two" etc are command line arguments. The $head_acc variable is
the key of the inner hashes. I have tried the following but it
doesn't work:
foreach $match (@{$line_sec{$ARGV[0]}}{$head_acc})
{
if ($match eq $current_acc)
{
...
}
}
The array I would like to obtain for the case of "one" and "WXYZ" for
instance would be (GHIH ELFO).
Is there a way I can do this?
Thanks in advance for your help.