in reply to how do i store the result from query into hash
Use fetch or fetchrow to fetch each result row in as an array. From there it's not hard at all. For each row, the key is the first member of the array, and the value is the second member of the array. So, assuming $sth is your statement handle,
Oughta do the job. (note: make sure that all the first entries in each row are unique, or you risk overwriting previous values.)while ( my @row = $sth->fetchrow() ) { $hash{$row[0]} = $row[1]; }
HTH
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
|
|---|