title: Perl Syntax Error - "syntax error line 15 near "} else" "
body: <p>I've got a <strong>really</strong> annoying problem in Perl. Here is my code:</p>
  
  <pre><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 "&lt;html&gt;&lt;head&gt;&lt;title&gt;Unauthorized&lt;/title&gt;&lt;/head&gt;&lt;h1&gt;Unauthorized&lt;/h1&gt;&lt;body&gt;You do not have permission to access \printenv\printenv.pl on this server.&lt;/body&gt;&lt;/html&gt;";
  }
  </code></pre>
  
  <p>When I execute this code I get the following error message:</p>
  
  <pre><code>syntax error line 10 near "else"
  </code></pre>
  
  <p>Any Ideas?
  Note that some of the code has been removed.</p>