Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: printing refence of hash inside a hash

by liverpole (Monsignor)
on May 12, 2007 at 14:13 UTC ( [id://615076]=note: print w/replies, xml ) Need Help??


in reply to printing refence of hash inside a hash

Hi opensourcer,

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' };

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://615076]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-03-29 07:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found