Possible Duplicate:
What decides the order of keys when I print a Perl hash?
Say I got a simple script to list the contents of a hash from a book:
my %hash = ("a" => 1, "b" => 2, "c" => 3, "d" => 4);
for my $i (%hash) {
print $i . "\n";
}
On one computer it lists:
c
3
a
1
b
2
d
4
But on another it has it proper (in order): a
1
b
2
c
3
d
4
Why does it do this? does the foreach list it randomly or is it some random bug? My current (the c-a-b-d one is running Perl 5.10.1 the other 5.6?)