Code: Http: /xxxxx/cgi/perl-cgi.cgi? Name = itech & url = itech.cnblogs.com & p1 = test1
# ! /Usr/bin/perl-WT
# Shoshould use strict and warnning
Use Warnings;
Use Strict;
Use CGI;
# To debug Error
Use CGI: carp QW (warningstobrow.fatalstobrowser );
# Or debug from command line by: Perl-CWT yourcgi. cgi
# Or debug by: tail/var/log/Apache/error_log
# Make sure yourcgi. cgi is world excutable or 755 permission
# Just include sub features of CGI, standard means, 'html2', 'html3', 'html4', 'form' and 'cgi '. # use cgi qw (: Standard );
# Must define and initialize
My $ P1 = '' ;
My $ P2 = '' ;
My $ Name = '' ;
My $ URL = '' ;
My $ Q = New CGI;
$ P1 = $ Q -> Param (' P1 ' ) If $ Q -> Param ( ' P1 ' );
$ P2 = $ Q -> Param ( ' P2 ' ) $ Q -> Param ( ' P2 ' );
$ Name = $ Q -> Param ( ' Name ' ) $ Q -> Param ( ' Name ' );
$ URL = $ Q -> Param (' URL ' ) $ Q -> Param ( ' URL ' );
Print $ Q-> Header ();
Print $ Q-> Start_html (-Title =>"Hello World");
Print " P1: $ P1 <br> " ;
Print " P2: $ P2 <br> " ;
If (! Defined ( $ P2 )){ Print " P2 is not defined <br> " ;}
If ( $ P2 EQ "" ){ Print " P2 is empty <br> " ;}
Print
Hello
my name is $ name , and my web URL is
" $ URL " $ URL .
endhtml
$ Q-> H3 ('Welcome to here! <Br>');
Print "$ ENV {remote_addr} <br>";
Print $ Q-> End_html ();
Complete!