foreach my $i ($ref->%b} { print $i; # I want to see the content of the hash. }
"b" in the hash is now only a hash key, and therefore you cannot put a "%" sign before "b", but you need a %{...} to dereference the hash. This will work:
foreach my $i ( %{ $ref->{b} } ) { print $i; # I want to see the content of the hash. }
(It will print keys and values by turns.)
In reply to Re^3: How to Print Return Data from Subroutine
by betterworld
in thread How to Print Return Data from Subroutine
by bichonfrise74
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |