I cannot say if you should query your database for all possible results and store them in a hash or query them one at a time as you find them. Apart from anything else I've no idea how big this dataset may be. However you do either:
# prepare the sql once my $sth = $dbh->prepare(q/select column1 from mytable where column2 = +?/); # while(something) { # assuming only one column and one row are returned $sth->execute($my_key_into_table); my ($column1) = $sth->fetchrow; }
or
my $hashref = $dbh->selectall_hashref(q/select column1,key_column from + mytable/, 'key_column');
In reply to Re: SQL Lookup/HASH
by mje
in thread SQL Lookup/HASH
by drodinthe559
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |