in reply to Minimize Hash Key Value Combinations

If the Keys are very small, yet the values are large strings, why not put the string values in an array, then store the array indices under your keys?

my @big_strings = ( 'War and peace', 'The Lord of the rings', 'PI, to plenty of decimal places', ); my %keys = ( # give index into big_strings [a, b, c] => [1, 2], [b, d] => [0, 2], );

your use of something looking like lists, for 'keys' troubles me somewhat. What are you actually trying to achieve here? Is this perhaps an X-Y problem? When you walk up to your hash with a 'key' will that key be 'a' or a list a,c,g ?

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!

Replies are listed 'Best First'.
Re^2: Minimize Hash Key Value Combinations
by AlexTape (Monk) on Nov 18, 2013 at 14:41 UTC
    thank you! that was my firt approach.. just use the strings as keys e.g.:
    1 => A, B, C 2 => A, B, D 3 => C
    but it leads to the same problem.. the result should be this:
    1, 2 => A, B 2 => D 1, 3 => C
    $perlig =~ s/pec/cep/g if 'errors expected';

      I don't get it... what happened to A2 and B2?

        sorry.. fault again:
        1 => A, B, C 2 => A, B, D 3 => C
        1 points on string A, B and C
        2 points on string A, B and D
        3 points on string C
        1, 2 => A, B 2 => D 1, 3 => C
        1 points on string A, B and C
        2 points on string A, B and D
        3 points on string C
        $perlig =~ s/pec/cep/g if 'errors expected';