perl写cgi之helloworld

用perl写cgi和c/c++写cgi差不多,请参照我的上一篇文章c/c++写cgi之helloworld

这里只说明了怎么用perl写一个cgi的helloworld程序

创建新文件hello.pl, 内容如下:

#!/usr/bin/perl

print "Content-type: text/html\r\n\r\n";
print "Hello World!\n";

用命令chmod 777 hello.pl使hello.pl可执行

copy hello.pl到 cgi-bin目录下

在浏览器里打http://localhost/cgi-bin/hello.pl就可以看到结果了

另外,我发现并不需要在httpd.conf 的 AddHandler cgi-script .cgi后面加 .pl也是可以的。

1 thought on “perl写cgi之helloworld”

  1. hello!,I like your writing very much! share we communicate more about your article on AOL? I require an expert on this area to solve my problem. May be that’s you! Looking forward to see you.

Comments are closed.