in reply to Re^4: Best way to send records to the browser?
in thread Best way to send records to the browser?
$hash1{fname} = $rray[1]; $hash2{$record} = %hash1;
Values stored in hash entries can only be scalar (not hashes or arrays), so you need to store a reference to a hash, which is scalar. You get a reference with \
$hash2{$record} = \%hash1;
But note that this would store references to the same global hash, in which you'd just overwrite the fname entry for every record. You most likely want separate hashes, i.e.
my %hash1; # new hash instance $hash1{fname} = $rray[1]; $hash2{$record} = \%hash1;
or simply
$hash2{$record} = { fname => $rray[1] };
(the { } create an anonymous hash and return a reference to it)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Best way to send records to the browser?
by Perobl (Beadle) on Jun 26, 2010 at 19:16 UTC | |
by almut (Canon) on Jun 26, 2010 at 19:45 UTC | |
by Perobl (Beadle) on Jun 26, 2010 at 21:52 UTC |