Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: help on reference to hash

by skyworld_chen (Acolyte)
on Jun 21, 2014 at 08:36 UTC ( [id://1090739]=note: print w/replies, xml ) Need Help??


in reply to Re: help on reference to hash
in thread help on reference to hash

Hi Dave,

thanks for your kind reply. I have tried the code, but it seems I have some problem on this piece of code:

my %my_tcldefs = %{$cliParms->{'tclDefs'}};

there is no value passed to %my_tcldefs and %my_tcldefs is empty. Could you please give me more guidance? thanks very much!

Replies are listed 'Best First'.
Re^3: help on reference to hash
by AppleFritter (Vicar) on Jun 21, 2014 at 09:52 UTC

    That's because it should be tcl_defs, not tclDefs:

    my %my_tcldefs = %{$cliParms->{'tcl_defs'}};

    EDIT: for the benefit of later readers and to avoid confusion, when I wrote this reply, the original question (since edited, apparently) indeed said tcl_defs.

      Hi Dave,

      that is not the reason. Original design is tclDefs and I'm sure I matched the name in original reference. I guess there maybe other reasons, but I can't find it. thanks.

        In that case I'm not sure. The following works for me:

        #!/usr/bin/perl use feature qw(say); use Data::Dumper; $cliParms = { 'tcl_defs' => { my_var1 => 'a', my_var2 => 'b' } }; my %my_tcldefs = %{$cliParms->{'tcl_defs'}}; say Dumper(\%my_tcldefs);

        Could you post the code that's currently failing for you?

        P.S. I'm not Dave (davido).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found