in reply to non-scalar hash key

Sounds like you need a HoA (hash of arrays).

Check out the PDSC

Darren :)

Replies are listed 'Best First'.
Re^2: non-scalar hash key
by Anonymous Monk on Jun 17, 2009 at 09:57 UTC
    I think he want array of integers to become key, not value
        ah, okay.

        Well, a reference to an array is a scalar. So, perhaps something like:

        my @foo = qw/1 2 3 4 5 6/; my %bar = ( \@foo => 'elephants', ); my $zonk = \@foo; print "$bar{$zonk}\n";

        Darren :)

        I'm wondering why this is so difficult. If you take a string as the key to a hash, that string is actually an array of bytes, which is probably searched for by the C function strcmp. Now all I want is an array of which the elements are a tad larger (4 bytes iso 1 byte, because I need unsigned longs), and possibly another hash function (hashword in and another comparison function similar to strcmp but working on integers.