[Israel.pm] order on hash

Chanan Berler bc.other at gmail.com
Wed Mar 30 08:13:07 PDT 2011


Many reason can be found: performance issue if the values are 20k keys/values
but mainly it's theoretical question.

PS: it came up, when doing select on table in mySQL, where there is no
'order by' and no primary key on the table
which order the values are displayed / can i assume it will take the
'insert' record order (since mySQL handle the data in data files - can
i assume same order if i do simple select)

Chanan

On Wed, Mar 30, 2011 at 5:02 PM, Yaron Golan <yargolan at gmail.com> wrote:
> I am far from knowing the answer but why don't you sort the keys and make
> sure that they are at the same order each time you run the code ?
>
> On the other hand, if this is another of those theoretical questions, my
> first 7 words should be read again ...
>
> YG
>
>
> On Wed, Mar 30, 2011 at 4:59 PM, Chanan Berler <bc.other at gmail.com> wrote:
>>
>> Hello All,
>>
>> I have 2 different Linux machines (same OS version / same Perl version):
>> (assuming there are least 200 keys/values - same keys/values on both
>> machines)
>> I wonder if i do
>> foreach (keys $myHash)
>> {
>> print $_=$myHash{$_};
>> }
>>
>> will it print the same on both machines ? will the order be exactly the
>> same ?
>> friend of mine, says it's same B-Tree algorithm on both machines,
>> since it's same Perl version.
>> What do you think ?
>>
>> thanks
>> Chanan
>>
>>
>> --
>> ===================
>> ----     Chanan Berler    ----
>> ===================
>> _______________________________________________
>> Perl mailing list
>> Perl at perl.org.il
>> http://mail.perl.org.il/mailman/listinfo/perl
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl
>



-- 
===================
----     Chanan Berler    ----
===================


More information about the Perl mailing list