in reply to Checking SQL Syntax
You could do (untested:)
my $ok = $dbh->do("explain $sql"); [download]