$sth = $dbh->prepare("SELECT username,password,group FROM users WHERE group = 'admin'"); $sth->execute(); while( my ($user,$pass,$group) = $sth->fetchrow_array ) { print "$user,$pass,$group\n"; }