Hi all,

$ref is a reference to a hash. Hash contains a component called "a" which is an array. I would like to iterate all elements of said array.

I would like to do something along the lines of:
foreach my $elem @%$ref{a}
{
   print "$elem\n";
}

Which, I think it clear, does not work. I also tried:
foreach my $elem @(%$ref){a}
{
   print "$elem\n";
}

which complains about:
Bareword "a" not allowed while "strict subs" in use

and:
foreach my $elem @(%$ref){'a'}
{
   print "$elem\n";
}

which complains about:
Global symbol "$elem" requires explicit package name at line 3 (i.e. - inside the for).

Any help would be appreciated.

Thanks,
Shachar

--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com


--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com

_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

Reply via email to