in reply to printing refence of hash inside a hash
What shmem points out is that you're apparently trying to use $_ to refer to 2 separate (distinct) variables, which you can't do.
Samy_rio demonstrated one solution, which is to name the loop variable in each of the loops, so that there isn't a naming conflict.
I wanted to mention an alternative way of viewing the contents of a (possibly complicated) data structure, which is quite commonly used -- Data::Dumper.
For example:
use strict; use warnings; use Data::Dumper; my $data = { data => 'hello', complicated => { version => 1, type => 'struct', }, req => 'Submit' }; print "Contents of \$data: ", Dumper($data), "\n";
which prints:
Contents of $data: $VAR1 = { 'req' => 'Submit', 'complicated' => { 'version' => 1, 'type' => 'struct' }, 'data' => 'hello' };
|
|---|