title: Scope issue with for loops
body: <p>I am new to perl, and am having some scope or syntax issues.</p>
  
  <p>I am trying to write a piece of code that reads lines from a file, splits them up at a certain delimiter into two pieces, and then stores each half as a key value pair in a hash. This is my code:</p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  
  my $filename = $ARGV[0];
  
  open(my $fh, '&lt;:encoding(UTF-8)', $filename)
    or die "Could not open file '$filename' $!";
  
  my @config_pairs;
  while (my $row = &lt;$fh&gt;) {
    chomp ($row);
    push (@config_pairs, $row);
  }
  
  my %config_data;
  for my $pair (@config_pairs) {
    my ($key, $value) = split(/\s*=\s*/, $pair);
    %config_data{$key} = $value;
  }
  
  for my $k (%config_data) {
    print "$k is %config_data{$k}";
  }
  </code></pre>
  
  <p>When I try and run this I get:</p>
  
  <pre><code>$ perl test_config_reader.pl --config.txt
  "my" variable %config_data masks earlier declaration in same scope at test_email_reader.pl line 22.
  syntax error at test_config_reader.pl line 19, near "%config_data{"
  Global symbol "$value" requires explicit package name at test_email_reader.pl line 19.
  Execution of test_config_reader.pl aborted due to compilation errors.
  </code></pre>
  
  <p>I am not sure what I am doing wrong. Clearly I don't understand how perl works yet.</p>