title: Perl: Global Symbol Requires Explicit Package Name
body: <p>So I've been attempting to find the solution to this but so far everything I've read online has to do with scope issues and not declaring the variables with the <strong><em>my</em></strong> keyword. However, I can't seem to fix the issues because I've declared everything at the top and, to me at least, it seems I don't have scope issues. My errors for the following code are:</p>
  
  <pre><code>Global symbol "$filename" requires explicit package name at read_ids.pl line 6.
  Global symbol "$filename" requires explicit package name at read_ids.pl line 8.
  Global symbol "$filename" requires explicit package name at read_ids.pl line 9.
  Global symbol "$filename" requires explicit package name at read_ids.pl line 22.
  </code></pre>
  
  <p>The code:</p>
  
  <pre><code>use strict;
  use warnings;
  
  #Create array of IDs.
  my @ids
  my $filename = 'ids.csv';
  
  open(my $fh, '&lt;:encoding(UTF-8)', $filename)
      or die "Could not open file '$filename'.";
  
  #Read line using the readline operators &lt;&gt;.
  while (my $row = &lt;$fh&gt;) {
  #Remove any newline characters from line using the chomp() command.
      chomp $row;
      push @ids,'$row';
  #  print "$row\n";
  }
  
  foreach (@ids) {
      print "$_\n";
  }
  print "Read '$filename' successfully.\n";
  </code></pre>