It looks like you're trying to use CGI.pm to me ...
this code will work:
#!/usr/bin/perl
use CGI;
$q = new CGI;
$query = $q->Vars;
print "Content-type: text/html\n\n";
$text=$query->{message};
print "<HTML><BODY>
</BODY></HTML>";
... where you call the script as script.cgi?message=whatever