in reply to Re: adding to a hash
in thread adding to a hash
get_page_content(\%variables, "names"); # instead of %variables = get_page_content("names"); sub get_page_content { my ($hashref, $type) = @_; my $dbh = DB_File::connect(); $sth = $dbh->prepare (qq{ SELECT `name`,`value` FROM `page_variabl +es` WHERE `type` = ? }); $sth->execute($type); while(my ($db_name,$db_content) = $sth->fetchrow_array()) { $$hashref{$db_name} = $db_content; } $sth->finish(); }
|
|---|