in reply to Re^2: Ordering objects using external index
in thread Ordering objects using external index

That makes it look like your using symbolic references? Ie. Variable names that are (partially) made up from other variable names. eg.

$uid = 5674; ${'msg' . $uid } = ...;

In which case, you should be making that a hash directly:

push @uid, 5674; $msgs{ $uid[ -1 ] } = ...;

then you wouldn't be having the mapping problem later on. Producing your ordered array would then become a simple hash slice:

@ordered = @msgs{ @uid };

It's difficult to know without seeing how the variables and data in your snippets are beiing created.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^4: Ordering objects using external index
by kappa (Chaplain) on Sep 07, 2004 at 11:14 UTC

    No, of course not, I don't use symbolic references, sorry for confusion.

    I have an array of messages, not a hash. The operation of converting that array to hash keyed by one of message properties (namely, uid) is exactly what I want to avoid as it is expensive.

    I like your suggestion, though, of not having that message array in the first place, but I think this is hard to implement. At present the only format of getting those messages is in unordered lists, too bad (there's IMAP on the other end).