in reply to Returning More Than One Hash
I am having a problem with returning multiple hashes from a subroutine.
I'm not even a little surprised. In fact you can't even return a single hash from a sub. Only a list. If the list consists of key-value pairs, then it can be conveniently assigned to a hash. Otherwise, it can contain quite about anything, including hashrefs:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my ($x,$y) = sub () { {foo => 1}, {bar => 2, baz => 3}; }->(); print Dumper $x, $y; __END__
Output:
$VAR1 = { 'foo' => 1 }; $VAR2 = { 'bar' => 2, 'baz' => 3 };
|
|---|