Was wondering what the most effective way to pull data from a mySQL table into a CGI script?

I am currently doing it like so.

$get = ("SELECT * FROM table (WHERE data = want)");
$data = $dbh->do($get);