... sub test { my (@names_all, @email_all); my @name = qw(Joe mary ann pete amy jerry); my @email = qw(joe@test.com mary@test.com ann@nowhere.com pete@here.com amy@ok.com jerry@b.com); foreach $names(@names) { push @name_all, $names; } foreach $emails(@email) { push @email_all, $emails; } # need to make a hash instead of sending two arrays, how?? #return \@name_all, \@email; return \@name_all; } my $info = test(); foreach my $all(@$info) { print "\n$all\n"; } ...