in reply to two hashes occupying the same space

You can easily combine the two by inverting the first with a hash slice, @hash1{values %hash1} = keys %hash1; Be aware that you will lose some keys if there are duplicate values.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: two hashes occupying the same space
by ikegami (Patriarch) on Oct 28, 2004 at 04:18 UTC
    I think the OP is trying to have $value1 only once in memory, and $value2 only once in memory, in order to reduce memory usage. Sharing the same hash doesn't reduce memory usage, and constructing it in that manner is not very memory efficient.
Re^2: two hashes occupying the same space
by pg (Canon) on Oct 28, 2004 at 04:22 UTC

    Don't believe that's what he wants, that sounds too easy to me.

    He obviously needs both hash for search in both directions, and he cannot lose the original hash. Unless the the original hash is only useful for the first phase of the execution, and the reversed one is only needed for the second phase.