in reply to REF instead of HASH-ref
my %list = { 'lang' => 'de' };You want:
(Note the parens).my %list = ( 'lang' => 'de' ); my $listref = \%list;
Or you can do my $listref = { 'lang' => 'de' };(Note the curly braces).
Once you do that, print $listref->{'lang'} should print de, not any kind of stringified hash.
Check out perlref for more detail. Basically, the parenthese produce a list (which you can assign to a hash and then take a reference), and the curly braces produce an anonymous hash, whose reference you can store in a scalar.
Update
Added a little more detail....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: REF instead of HASH-ref
by zetetes (Pilgrim) on Sep 15, 2004 at 11:47 UTC | |
by VSarkiss (Monsignor) on Sep 15, 2004 at 15:06 UTC | |
by zetetes (Pilgrim) on Sep 15, 2004 at 19:54 UTC |