ChuckularOne has asked for the wisdom of the Perl Monks concerning the following question:

Is this supposed to work? If so do I have correct syntax?
The second tie (RecursiveCI) works, the first does not. I think I must be doing something wrong.
#!/usr/bin/perl -w use Tie::IxHash; tie %linehash, Tie::IxHash; use Tie::RecursiveCI; tie %linehash, 'Tie::RecursiveCI'; THE REST OF THE SCRIPT GOES HERE...
Thanks in advance,
-Chuck

Replies are listed 'Best First'.
Re: Can you Tie a hash twice?
by chromatic (Archbishop) on Apr 26, 2000 at 18:53 UTC
    I don't think you can double-tie a hash. My first guess was that the second tie overwrites the first.

    If you want to keep things in order, but can't find a tied hash that will work for you, keep a stack around, and push keys onto it as you add them to the hash. To get the keys out in order, just iterate through the stack.

    That's probably close to what Tie::IxHash does internally, anyway. You're just stuck with the housekeeping.

Re: Can you Tie a hash twice?
by ChuckularOne (Prior) on Apr 26, 2000 at 18:53 UTC
    There should have been single quotes around 'Tie::IxHash' and it still doesn't work.
    I think the problem is that IxHash.pm doesn't work on this system, because I cut out the use and tie for RecursiveCI and the IxHash still doesn't work. Does anybody know of another Hash Indexer? The end goal is to return my hash values in the order they went into the hash.

    Your Humble Servant,
    -Chuck