#in main.pl use packa; $obj = packa->new; $string = $obj->pass("problem1"); #print $string; %ha = $obj -> passhash; foreach $key (keys (%ha)){ if ($key eq "problem2"){ foreach (@ha{$key}){ print "array : @{$_}\n"; } } } #in packa.pm package packa; sub new{ my $class = shift; my $self = {}; bless($self); return $self; } sub pass{ my ( $problem1 )= @_; print "$problem1\n"; } sub passhash{ %hash = qw { dog voa cat mice }; $hash {'problem2'} = [["ha" , "thing", "thorw"], ["good", "ssa" , "ham"], ["as", "kid", "wo"], ]; return %hash; } 1;