i tried that earlier, but i think it has been my problem to not diagnose the problem. until i have added print "Content-type: text/html\n\n" and print to rest to the top of script and am getting the results the actual results i want in header. but not in html. in html am just getting only 1 results #### results 35 56 Content-type: text/html # this comes very well but. cant use it on top of script for production use Age list 35 # am getting only this in html and i want to get all like in header #### #!/usr/bin/perl -w print "Content-type: text/html\n\n"; use DBI; my $host = "localhost"; my $usr = "root"; my $pwd = ""; my $dbname = "test"; my $DBH = DBI->connect("DBI:mysql:$dbname:$host", $usr, $pwd, { AutoCommit => 0, RaiseError => 1, }) or die $DBI::errstr; my $sth = $DBH->prepare(' SELECT DISTINCT AGE FROM USERS WHERE NAMES = ?'); $sth->execute('John'); my $records = $sth->fetchall_arrayref; for my $record (@$records){ print $rest = $record->[0]; } print "Content-type: text/html\n\n"; print < Untitled Document

Age list

$rest

START_HTML