Perl's conditions confuse me, and it is not my native language, so bear with me. I will try to use the correct conditions, but I will give an example to make sure.
So, I have a hash reference in the variable $ foo. Suppose $ foo → {'bar'} → {'baz'} is an array reference. That is, I can get the first member of the array by assigning $ foo → {'bar'} → {'baz'} → [0] scalar.
when i do this:
foreach (@$foo->{'bar'}->{'baz'}) {
I get the error "No ARRAY link on script.pl line 41"
But when I do this, it works:
$myarr = $foo->{'bar'}->{'baz'}; foreach (@$myarr) {
Is there something I don't understand? Is there a way to make the first example work? I tried to wrap the expression in parentheses with @ outside, but that didn't work. Thanks in advance for your help.
source share