in reply to Re: Hashes & Arrays
in thread Hashes & Arrays

Dear vroom unfortunately I have no code and need help with that :)

Replies are listed 'Best First'.
Re^3: Hashes & Arrays
by GrandFather (Saint) on Aug 29, 2005 at 20:34 UTC

    A first step is to read the documentation. Then draw the data as it will be structured on paper, or other suitable material of your choice, using indentation to show the nesting of the various elements and either {}, () or [] as appropriate to show the type of element. So for example and array of arrays (AoA) might look like this:

    ( ["1 in 1", "2 in 1", "3 in 1"], ["1 in 2", "2 in 2", "3 in 2", "4 in 2"], ["1 in 3", "2 in 3"] )
    Then you can do stuff like
    my @array = ( ["1 in 1", "2 in 1", "3 in 1"], ["1 in 2", "2 in 2", "3 in 2", "4 in 2"], ["1 in 3", "2 in 3"] );

    to create the array of arrays. Of course until you show us a little code so that we can see what you are trying to achieve it is hard to help much more than that. And yes, I do know that you are after a different data structure than that, but I'm sure with a little work you can at least get to the point of writing some code, even if it doesn't do what you expect.


    Perl is Huffman encoded by design.