my $sth = $dbh->prepare( "select ..." ); # sql with "?" in there somewhere $sth->execute( $param ); # pass a value from cgi params my $rows = $sth->fetchall_arrayref; if ( ref( $rows ) eq 'ARRAY' and @$rows ) { print ""; print "\n"; for my $row ( @$rows ) { print "\n"; } print "
UserSystem
" . join( "", @$row ) . "
\n"; } else { print "

No matches found.

"; }