use Net::MySQL; my $mysql = Net::MySQL->new( hostname => 'localhost', database => 'mytestdb', user => 'mysql', password => 'mysql' ); ... my $SQL = "select * from table1 where field1 = 1"; $mysql->query($SQL);