title: Why do I get a duplicate declaration in same scope warning in an if/elsif tree?
body: <p>Why does the following code warn? $match is scoped to the if block and not the containing while block.</p>
  
  <pre><code>use strict;
  use warnings;
  use 5.012;
  
  use IO::All;
  
  my $file = io($ARGV[0])-&gt;tie;
  my $regex = qr//;
  
  while (my $line = &lt;$file&gt;) {
    if (my ($match) = $line =~ $regex) {
      ...
    }
    elsif (my ($match) = $line =~ $regex) {
      ...
    }
    say $match;
  }
  </code></pre>
  
  <hr>
  
  <pre><code>C:\&gt;perl testwarn.pl test.log
  "my" variable $match masks earlier declaration in same scope at testwarn.pl line 15.
  Global symbol "$match" requires explicit package name at testwarn.pl line 18.
  Execution of testwarn.pl aborted due to compilation errors.
  </code></pre>
  
  <p>As expected, it complains that $match is not defined at line 18, but it also complains about the redeclaration of $match in the if blocks. Version is slightly out of date but not horribly so; and it's the most recent Strawberry version:</p>
  
  <pre><code>This is perl 5, version 12, subversion 3 (v5.12.3) built for MSWin32-x86-multi-thread
  </code></pre>