in reply to Re: Re: Managing Client Specific Hashes
in thread Managing Client Specific Hashes

I would be sorting the array by index and not value... I'm not understanding why you think an array is a viable option... please explain that.. I would like to understand.
So, you are sorting the array (I think you mean the list of keys here), but you don't think an array is a viable option? Storing the data in a sorted array instead of storing them in a hash, and sorting it before usage, eliminates a step.

Abigail

Replies are listed 'Best First'.
Re: Re: Managing Client Specific Hashes
by Grygonos (Chaplain) on Jan 13, 2004 at 18:47 UTC
    but the key is important data as well... the key is where the data field begins... and that hashes to how long the field is... can you present a sample array that does what you propose? Thanks if you have time.

    Grygonos
      my @a = ([ 1, 8], [ 9, 11], [ 20, 2], [ 22, 9], [ 31, 7], [ 38, 8], [ 46, 8], [ 54, 8], [ 62, 30], [ 92, 12], [104, 30]);
      Or if your array is large, and you want to save memory:
      my @b = ( [1, 9, 20, 22, 31, 38, 46, 54, 62, 92, 104], [8, 11, 2, 8, 7, 8, 8, 8, 30, 12, 30] );
      But if you look carefully, the "keys" aren't necessary at all - if all you do is process the data in order, the keys can be calculated from the values, and all you need to keep is:
      my @c = (8, 11, 2, 8, 7, 8, 8, 8, 30, 12, 30);

      Abigail

        an array of array ref's .. ok.. that makes more sense.. I would agree with computing the "keys" only that some data is not used in the file... so the computations could be off somewhere.(haven't looked into it) Thanks for working w/ me on this abigail

        Grygonos