----- Original Message ----- From: <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To: "Chris Charley" <[EMAIL PROTECTED]>
Cc: <beginners@perl.org>
Sent: Monday, January 10, 2005 1:23 PM
Subject: Re: complex data structure





----- Original Message -----
From: Chris Charley <[EMAIL PROTECTED]>
Date: Monday, January 10, 2005 12:59 pm
Subject: Re: complex data structure

I hope someone can explain this related question. When I run the
code below
I can try, I personaly perfer RoHoH..., looks like you have RoHoAoH
on Brano's data structure, 'each' gives me false results
Does it ?? Remember each will not itterate on Data sets. It simply returns key and value.

Right

but 'keys' gives me correct results. I'm kind of stumped!
because 'keys' itterates over data structures.

OK


test1[0] is a referance to a 2 key hash, since you called 'each' only once, you only got to see first part of the data set :). Here is some code to explain it, let me know if you need more help.


Thank you for your reply with the explaination. I now understand that 'each' will not iterate where keys does. Anyway, I will have to mull it over :-)

I changed the for loop to a while loop and 'each' worked the way I was expecting with the for loop. I was trying to do the assignment in the for loop and that was incorrect.

Changed that line
for (my ($k, $v) = each %$anon)
TO
while (my ($k, $v) = each %$anon)

Chris



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to