title: In Perl, how can I access a scalar defined in another package?
body: <p>I seem to be stuck trying to access a scalar which is defined in another package, and have narrowed down an example to a simple test case where I can reproduce the issue.
  What I wish to be able to do it access a reference to a list which is in defined within the package 'Example', using the our mechanism, however, Dumper is showing that the variable is always undefined within example.pl:</p>
  
  <p>Example.pm looks like the following:</p>
  
  <pre><code>#!/usr/bin/perl -w
  
  use strict;
  use warnings;
  use diagnostics;
  
  package Example;
  use Data::Dumper;
  
  my $exported_array = [ 'one', 'two', 'three' ];
  print Dumper $exported_array;
  
  1;
  </code></pre>
  
  <p>And the code which uses this package looks like this:</p>
  
  <pre><code>#!/usr/bin/perl -w
  
  use strict;
  use warnings;
  use diagnostics;
  use Data::Dumper;
  
  use lib '.';
  use Example;
  
  { package Example;
    use Data::Dumper;
    our $exported_array;
    print Dumper $exported_array;
  }
  
  exit 0;
  </code></pre>
  
  <p>Upon running this code, the first Dumper runs and things look normal, after this, the second Dumper, example.pl runs and the reference is then undefined:</p>
  
  <pre><code>$VAR1 = [
            'one',
            'two',
            'three'
          ];
  $VAR1 = undef;
  </code></pre>