package Foo; use strict; use Exporter 'import'; # Export on demand, so the caller knows # where these came from. our @EXPORT_OK = qw(get_array populate_array); { my @array; # can only be accessed in this block sub get_array { \@array } sub populate_array { @array = 'a' .. 'h' } } 1;