K
kevinwhite
I am trying to fix some code I inherited, and there are many warnings I
would like to clean up. The biggest offenders are as follows:
print <<"HTMLEND"; #<= this causes an uninitialized variable warning...
<html><head></head><body></body></html>
HTMLEND
The second example is:
my $htmlfile = "";
my $hide = "";
$htmlfile = param('filename');
$hide = param('hide') || "no"; #<= what does this do?
if ($htmlfile eq "default.html") #<= this causes an uninitialized
variable warning...
{ #do some stuff
}
The third problem I have is printing environment variables when I have
"use strict" enabled. What is the legal way to do this?
I have:
my $n;
my @keys;
my @values;
my $Item;
@keys = keys %ENV;
@values %ENV;
$n = 0;
foreach $Item (@keys) { $$Item = $values[$n++];}
foreach $Item (@keys) { print "$Item=$$Item"; }
Thanks in advance,
-Kevin
would like to clean up. The biggest offenders are as follows:
print <<"HTMLEND"; #<= this causes an uninitialized variable warning...
<html><head></head><body></body></html>
HTMLEND
The second example is:
my $htmlfile = "";
my $hide = "";
$htmlfile = param('filename');
$hide = param('hide') || "no"; #<= what does this do?
if ($htmlfile eq "default.html") #<= this causes an uninitialized
variable warning...
{ #do some stuff
}
The third problem I have is printing environment variables when I have
"use strict" enabled. What is the legal way to do this?
I have:
my $n;
my @keys;
my @values;
my $Item;
@keys = keys %ENV;
@values %ENV;
$n = 0;
foreach $Item (@keys) { $$Item = $values[$n++];}
foreach $Item (@keys) { print "$Item=$$Item"; }
Thanks in advance,
-Kevin