In article <lQSTe.145443$Hk.7356@pd7tw1no>, <a@mail.com> wrote:
my(%hashA,%hashB)
how to populate %hashA and %hashB that are inside a list?
Thanx
What does "hash inside a list" mean? I can guess that you are referring
to this construct for one hash:
my %hash = ( 'a' => 1, 'b' => 2 );
extended to two hashes:
my(%hash1,%hash2) = ('a'=>1, 'b'=>2), ('c'=>3, 'd'=>4);
except that doesn't work ("Useless use of a constant in void context").
This compiles:
my(%hash1,%hash2) = (('a'=>1, 'b'=>2), ('c'=>3, 'd'=>4));
except that all of the elements get assigned to %hash1. This is typical
for Perl, in that an array involved in an assignment will tend to
gobble up all remaining lvalues.
The short answer to your question is then: "You don't".
Is it so hard to write two lines?
my %hash1 = ('a'=>1, 'b'=>2);
my %hash2 = ('c'=>3, 'd'=>4);
If this is not what you want, then please be more explicit. It always
helps to include a short, complete program that demonstrates the
problem you are having and explain why the program is not doing what
you want.
FYI: this newsgroup is defunct. Please use comp.lang.perl.misc in the
future.