I want to select a set of items by ids on some predicate '--PREDICATE--' from an SQL table via DBI.
The long way:
use DBI; my $dbh = DBI->connect(...); .... my @ids = (); my $sth = $dbh->prepare('select id from items where '--PREDICATE-- +'); $sth->execute(); while (my ($id) = $sth->fetchrow_array()) { push @ids, $id; } $sth->finish(); ....
I want a shorter one line version.
I am sure there exists some neat contortion using $dbh->select(col|row|all)_(array|hash)(ref)? and referencing/dereferencing - I just can't see it (and am no good with arrays of hash of reference to hash list tap dancing -- $ref->2<-{3,4}[0]{2} -- :P )
-Andrew.
In reply to DBI select ids to @ids by tomazos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |