如何在数字eq(==)中修复未初始化的值

时间:2015-12-12 05:15:47

标签: perl

如何解决此错误:

[Fri Dec 11 12:07:24.417565 2015] [cgi:error] [pid 10838] [client     24.32.36.240:54536] AH01215:  [Fri Dec 11 12:07:24 2015] 
uu_upload.pl: Use of uninitialized value in numeric eq (==) at uu_upload.pl     line 350.:  /home/public_html/cgi-bin/uu_upload.pl, 
referer: http://www.....com/uploader.php

第349行 - 第353行显示:

# Force 'redirect_using_location' if user does not have a javascript capable     browser or using embedded_upload_results
if($query->param('no_script') || $query->param('embedded_upload_results') ==     1){
 $main::config->{redirect_using_js_html} = 0;
 $main::config->{redirect_using_location} = 1;
}

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

使用defined功能可以检查变量是否已定义。

if ( defined($variable) && $variable == 10 ) {
    ...
}