Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
perl w/website中的get函数在perl脚本中不产生值_Perl_Web_Null_Get - Fatal编程技术网

perl w/website中的get函数在perl脚本中不产生值

perl w/website中的get函数在perl脚本中不产生值,perl,web,null,get,Perl,Web,Null,Get,我试图获取index.pl?home=home以在perl脚本中生成值'home',或者home=anything以生成'anything' 由于某些原因,我没有正确使用GET方法 #!/usr/local/bin/perl use CGI qw(:standard); $cgi = new CGI; $home = $cgi->param('home'); 我做错了什么?我一直在搜索这个特定的答案…你的代码对我来说很好。我的完整脚本如下所示: #!C:/perl/bin/perl.e

我试图获取index.pl?home=home以在perl脚本中生成值'home',或者home=anything以生成'anything'

由于某些原因,我没有正确使用GET方法

#!/usr/local/bin/perl
use CGI qw(:standard);
$cgi = new CGI;
$home = $cgi->param('home');


我做错了什么?我一直在搜索这个特定的答案…

你的代码对我来说很好。我的完整脚本如下所示:

#!C:/perl/bin/perl.exe

use CGI qw(:standard);
$cgi = new CGI;
$home = $cgi->param('home');

print "Content-Type: text/plain\n";
print "\n";
print "Hello world\n";
print "Hello $home world\n";
(我在Windows上,但这不重要。)

当我访问
http://localhost/stack.pl?home=xx
我明白了:

Hello world
Hello xx world
添加
$cgi->header()添加到脚本中。您很可能遇到了“
脚本头过早结束
”错误:


查看您的错误日志以了解详细信息。

这正是我的想法,与我试图做的几乎相同。。。但出于某种原因,它显示为空白值。好了,现在它工作正常,我在两者之间删除了一个额外的value=value2链接,这是导致错误的原因!!!
#!/usr/local/bin/perl
use CGI qw(:standard);
$cgi = new CGI;
$home = $cgi->param('home');

print $cgi->header();
print $home