#!/usr/bin/perl -w use Test::More tests => 1; use ttt qw(get_key); my ($a,$b,$c) = get_key(); is($a,1); #### package ttt; use strict; use warnings; our @ISA = qw(Exporter); our @EXPORT = (); our @EXPORT_OK = qw(%config get_key); our %config = ( 'key' => [undef,undef,undef], ); BEGIN { $config{'key'} = [1,2,3]; } sub get_key { return @{$config{'key'}}; } 1; #### package ttt; use strict; use warnings; our @ISA = qw(Exporter); our @EXPORT = (); our @EXPORT_OK = qw(%config get_key); our %config; BEGIN { $config{'key'} = [1,2,3]; } sub get_key { return @{$config{'key'}}; } 1; #### package ttt; use strict; use warnings; our @ISA = qw(Exporter); our @EXPORT = (); our @EXPORT_OK = qw(%config get_key); our %config = ( 'a' => 'test', ); BEGIN { $config{'key'} = [1,2,3]; } sub get_key { return @{$config{'key'}}; } 1; #### Can't use an undefined value as an ARRAY reference at ttt.pm line 21. # Looks like your test died before it could output anything. #### our %config; BEGIN { %config = ( 'a' => 'test' ); $config{'key'} = [1,2,3]; } #### our %config; BEGIN { $config{'key'} = [1,2,3]; %config = ( 'a' => 'test' ); } #### Can't use an undefined value as an ARRAY reference at ttt.pm line 21.