in reply to Re^2: How to Print Return Data from Subroutine
in thread How to Print Return Data from Subroutine
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.)
|
|---|