in reply to Re: REF instead of HASH-ref
in thread REF instead of HASH-ref

if i do
my %list = ( 'lang' => 'de' ); my $listref = \%list; print ref($listref);
i get REF. if i do
my $listref = { 'lang' => 'de' }; print ref($listref);
i get HASH.

i use this with CGI. so i initialize the hash as follow:
use vars qw($query @parname %list $n ); $query = new CGI; @parname = $query->param; foreach $n (@parname) { $list{$n} = $query->param($n); }
i then just pass \%list along to a function which takes the refenrence and uses the hash again. i used exactly this code (copy/paste) in another app, there it worked fine. the environment is the same, too.

kind of puzzled. update: if i update the initialization to:
$query = new CGI; @parname = $query->param; foreach $n (@parname) { $hashref->{$n} = $query->param($n); }
everything works fine. hm...

Replies are listed 'Best First'.
Re^3: REF instead of HASH-ref
by VSarkiss (Monsignor) on Sep 15, 2004 at 15:06 UTC
      thank you, VSarkiss for your patience and the hint. i'll have a look at the doc.