an_ordinary_man has asked for the wisdom of the Perl Monks concerning the following question:
Acc. to the functionality of above code, each() function used on associative array, This program should print the following:%array = ( "100", "Green", "200", "Orange"); while (($key, $value) = each(%array)) { print("$key = $value\n"); }
But on running it on my machine, it returns:100 = Green 200 = Orange
On adding more key, value pairs it gives different results which I cannot find a pattern for. This same code when run on other machine with different perl running on it works. I really need to know why this does not come in the order as it is in the array.200 = Orange 100 = Green
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 1: each() function used in associative arrays gives incorrect unordered output.
by tilly (Archbishop) on Jan 19, 2002 at 13:02 UTC | |
Re: each() function used in associative arrays gives incorrect unordered output.
by rob_au (Abbot) on Jan 19, 2002 at 13:04 UTC | |
Re: each() function used in associative arrays gives incorrect unordered output.
by uwevoelker (Pilgrim) on Jan 19, 2002 at 13:30 UTC | |
Re: each() function used in associative arrays gives incorrect unordered output.
by Juerd (Abbot) on Jan 19, 2002 at 20:03 UTC | |
Re: each() function used in associative arrays gives incorrect unordered output.
by japhy (Canon) on Jan 19, 2002 at 21:19 UTC | |
Re: each() function used in associative arrays gives incorrect unordered output.
by trs80 (Priest) on Jan 19, 2002 at 21:33 UTC | |
by Juerd (Abbot) on Jan 19, 2002 at 21:59 UTC |
Back to
Seekers of Perl Wisdom