========================= shebang, initialization ... "do" etc. &main() sub main { my $cgi = CGI->new(); my %params = $cgi->Vars(); # Get the MAC address from the URL. my $id = $params{id}; my $sqlStmt; my $hStmt; my $hDb = AnotherModule::connectDb(); $sqlStmt = "SELECT several rows"; $hStmt = MyModule::execSql($hDb, $sqlStmt); my ($value1, $value2, $value3); my $list = ""; while ($value1, $value2, $value3) = $hStmt->fetchrow) { $list .= "$value1,$value2,$value3;"; } print "$list"; OtherModule::log($blah, $blah, "$list"); $hStmt->finish; $hDb->disconnect; exit(0); }