in reply to Comparing an array to a DBI table
my $sth = $dbh->prepare("SELECT userid FROM subscription") or die DBI: +:errstr; $sth->execute() or die DBI::errstr; my %db; while( my ( $id ) = $sth->fetchrow_array() ) { $db{ $id } = 1; } my @in_db = grep { defined( $db{ $_ } ) } @compare_array;
|
---|