Nope - 'cause if I print out the values key for key, I get all four:

my $array = keys %hash;

print $hash{$array[0]};
print"\n";
print $hash{$array[1]};
print"\n";
print $hash{$array[2]};
print"\n";
print $hash{$array[3]};

With the code
foreach (keys %hash) {
        print $hash{$_};
        print "\n";}

I only get the value corresponding to $hash{$array[3]}.

Jane


James Edward Gray II wrote:


On Nov 11, 2003, at 1:47 PM, Christiane Nerz wrote:

Hi!
If I want to print out every value of a hash, what's wrong with doing it like that:


foreach (keys %hash) {
    print $hash{$_};
    print "\n";}

Why do I only get one value???


I don't seen anything wrong with your code. I believe there is only one value in the hash, if that's all you see. Check the code that loads it.

James






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to