Maybe you didn't say your hashes were 'my' variables?


our %h1 = qw(a A b B c c);
our %h2 = qw(x X y Y z Z);
my %h3 = qw(r R s S t T);


for my $it (qw(h1 h2 h3)){
        @$it = %$it;
        print join " ",  $it, ": ", @$it, "\n";

}

...prints....

Name "main::h1" used only once: possible typo at symrefhash.pl line 2.
Name "main::h2" used only once: possible typo at symrefhash.pl line 3.
h1 :  a A b B c c
h2 :  x X y Y z Z
h3 :

(Ignore the -w's about 'only once'.)

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Peter Eisengrein
Sent: Thursday, June 14, 2001 1:44 PM
To: Perl-Win32-Users Mailing List (E-mail)
Subject: @$_ works, so why doesn't %$_ ?


Aaarggghhhhh. This is making me nutty! I have several hashes that I want to
process identically, so I put their names in an array and want to call those
names iteratively from the array. But I just can't get it to work. Please
help!


### here's what I am trying to do:
my @list = ("hash_one","hash_two","hash_three");
foreach (@list)
{
        ### now process %$_ which I want to be
        ### %hash_one
        ### then %hash_two
        ### then %hash_three
}



I've used @$_ before, so why doesn't %$_ work? I've tried...
%$_
%{$_}
%${_}
%{${_}}
%\$_
%(eval($_))
... and every other combination I can think of. I'll just be here banging my
head on my desk........

Thanks group.

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to