return two hashes for sub

http://www.perlmonks.org/?node_id=647264

 

You'll need to return references to your hashes from the sub, as in:

return(\%test1, \%test2);

 

In the caller, if you must, you can dereference the hashrefs by:

my ($test1,$test2) = &testsub;
my %test1 = %$test1;
my %test2 = %$test2;
posted on 2018-03-21 13:02  guolongnv  阅读(106)  评论(0)    收藏  举报