In that case, we will need a more complete example of your code. Is the $cgi object in the current scope? Did you turn on strict and warnings?
For now, try the following sample:
use CGI::Carp qw(fatalsToBrowser); # not needed per se, but very usefu
+l for debugging
my $cgi = new CGI();
print "alert('", $cgi->param("value1") || "nothing", "');\n";
"Excuse me for butting in, but I'm interrupt-driven..."