package Shared; use warnings; use strict; use Exporter qw{ import }; our @EXPORT_OK = qw{ test_val test_list }; sub test_val { "hello world\n" } sub test_list { ( [ 'Shadow', 'Blinky' ], [ 'Speedy', 'Pinky' ], [ 'Bashful', 'Inky' ], [ 'Pokey', 'Clyde' ], ) } __PACKAGE__ #### #!/usr/bin/perl use warnings; use strict; use Shared qw{ test_val test_list }; print test_val(); for my $pair (test_list()) { print "@$pair\n"; } #### package Shared_OO; use warnings; use strict; sub new { my $class = shift; bless { test_val => "hello world\n", test_list => [ [ 'Shadow', 'Blinky' ], [ 'Speedy', 'Pinky' ], [ 'Bashful', 'Inky' ], [ 'Pokey', 'Clyde' ], ], }, $class } sub test_val { shift()->{test_val} } sub test_list { @{ shift()->{test_list} } } __PACKAGE__ #### #!/usr/bin/perl use warnings; use strict; use Shared_OO; my $o = 'Shared_OO'->new; print $o->test_val; for my $pair ($o->test_list) { print "@$pair\n"; }