DB access problems



I am new to perl.

I have built an AJAX app that works the way I want it. The app. has a
dynamic scroll list that displays inventory. Right now an array(hard
coded) fills a dynamic list.

I have placed the AJAX app. on a Linux server and can access it from
the web. It is now time for me to query the DB (which I am able to do
already), take that data and pass it to a JavaScript function that will
format the data for my array that will populate the list.

Problem: I don't know how to do that.

Questions: Do I have to build the HTML with statements like print
"<html>\n"; in my CGI?

Am I able to access the JavaScript and pass the data?

I guess I'm not sure about the layout and how to put it together. I
have read and searched online but have not found any examples for what
I want to do. I know there has to be plenty of these applications out
there.

Again, I am trying to query a DB on a Linux server. Use that data to
populate a dynamic scroll list in a HTML doc.

Any help/examples is appreciated. Thanks in advance.

.