At 11:12 AM 5/5/2006 -0400, Joe Discenza wrote:
>{name => 'a', status => 0}, {name => 'b', status => 1}, {name => 'c',
>status => 1}, {name => 'd', status => 0}
>
>and I sort { $a->{'status'} <=> $b->{'status'} }
>
>Should I expect the result (order of the names) to always be ('a', 'd',
>'b', 'c'), or could it be, for example, ('d', 'a', 'b', 'c') (i.e.,
>could two entries with the same status value change relative order)?
The ordering is going to be random between script invocations if u try to do
it on a pure hash. That's because the ordering within a hash is random, or
rather something convenient for perl. Sorting an array will be constant
between script invocations because the original order is always the same.
What ur doing here is essentially just sorting an array with a name in the
place of the index. So it should remain constant.
--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede malis"
00000100
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs