I’ve got a really annoying problem in Perl. Here is my code:
if $password eq "a_secret";
{
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print '${var}=\"${val}\"\n'
};
}
else
{
print "<html><head><title>Unauthorized</title></head><h1>Unauthorized</h1><body>You do not have permission to access \printenv\printenv.pl on this server.</body></html>";
}
When I execute this code I get the following error message:
syntax error line 10 near "else"
Any Ideas?
Note that some of the code has been removed.
1 Answer