title: Perl Error: Global symbol requires explicit package name
body: <p>I have a file that has </p>
  
  <pre><code>#File content
     word1 -&gt; word2
  word3 -&gt; word4
  </code></pre>
  
  <p>and I need to put this in 2 different arrays as</p>
  
  <pre><code>@array1 = word1, word3
  @array2 = word2, word4
  </code></pre>
  
  <p>My code is as below</p>
  
  <pre><code>my @mappings = `cat $file_name`; 
  foreach my $map (@mappings) { 
      $map =~ s/^\s+|\s+$//g; #Remove leading and trailing spaces 
      next if ($map =~ /^#/); 
      my @Mainarray = split ('-&gt;',$map); 
      my @array1 = push(@array1,@Mainarray[0]); **#Error line**
      my @array2 = push(@array2,@Mainarray[1]); **#Error line**
      print("Array1: @array1\nArray2:@array2\n"); 
  }
  </code></pre>
  
  <p>I am getting this error:</p>
  
  <pre><code>Global symbol "@array1" requires explicit package name.
  Global symbol "@array2" requires explicit package name.
  </code></pre>
  
  <p>Can someone please help me with this.</p>