in reply to Re: Re: Stuck while learning about the hash
in thread Stuck while learning about the hash
Then the value foo will always be in the first position in the array, unless you later reassign it in some way.$array[0] = "foo"
and you later run:$hash{foo} = "abc"; $hash{bar} = "xyz";
You cannot expect the key 'foo' to be returned first and 'bar' to be second. The only way to guarantee your output here is to run the command through something like sort:@somearray = keys %hash
-Eric@somearray = sort(keys %hash);
|
|---|