my %my_tcldefs = %{$cliParms->{'tclDefs'}};
The expression $cliParms->{'tclDefs'} treats $cliParms as a hash reference rather than as a hash as shown on the OPed code. Fixing that and the key name tyop (and using Dumper properly :) gives:
c:\@Work\Perl\monks>perl -wMstrict -MData::Dumper -le "my %cliParms = ( tclDefs => { my_var1 => 'a', my_var2 => 'b' }, ); print Dumper \%cliParms; ;; my %my_tcldefs = %{ $cliParms{tclDefs} }; print Dumper \%my_tcldefs; " $VAR1 = { 'tclDefs' => { 'my_var2' => 'b', 'my_var1' => 'a' } }; $VAR1 = { 'my_var2' => 'b', 'my_var1' => 'a' };
Update: skyworld_chen: The expression $cliParms->{'tclDefs'} assumes the existence of a scalar $cliParms that has been assigned a hash reference, which is evidently not the case in your code. Had you enabled warnings and, in particular, strictures (see strict), you might have had "more guidance" from Perl itself in the form of a "Global symbol "$cliParms" requires explicit package name ..." message (followed by the failure of the code to compile).
In reply to Re^2: help on reference to hash
by AnomalousMonk
in thread help on reference to hash
by skyworld_chen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |