use strict; use DBI; my $db = DBI->connect("dbi:mysql:dbname=database", "user", "password"); bind_col(q{SELECT MEH, MOOSE FROM BLEH WHERE pissant = ?},q{"3"},'$meh', '$moose'); sub bind_col { my $sth; my $statement = shift; my $execute = shift; $sth = $db->prepare($statement); $sth->execute($execute); $sth->bind_columns(\(@_)); while ($sth->fetch) { print @_; } } $db->disconnect();