in reply to array of arrays

Update: You actually have the square brackets, but you didn't use <code></code> tags around your code.

If you believe that

push @i2g, @miniarray;
is creating an array of arrays, you are wrong. Multidimensional data structures are created by collecting references -- an array of arrays is really an array of array references, for example. So to do what (I think) you want:
push @i2g, [@miniarray];
perldoc perlreftut for some more information.

We're not really tightening our belts, it just feels that way because we're getting fatter.

Replies are listed 'Best First'.
Re^2: array of arrays
by stalkeyefly (Novice) on Jun 16, 2004 at 10:24 UTC
    Sorry all for the lasck of use of code tags. And thanks for the editing. I can appreciate that if you are going to ask if your code is okay that it helps to present bin such away that people can in fact read it.

    The code that I posted does run - part of the out put shown below. I just did not know if this was the correct output.

    ARRAY(0x846aa04)ARRAY(0x846aa4c)ARRAY(0x846aa94)ARRAY(0x846aadc)...etc..

    Now assuming thats correct, do I need to send the AoA back to the main program for it to be used by another sub_routine. or can I change the way its decleared to make it a global variable?
    this is a far as i have got with scoping - using my outside a subroutine, I make a the variable visiable to whole program. Using my insdie a subroutine local makes it local....

    Edited by Chady -- shortened the list of array refs because it was breaking the browsers and the actual memory addresses were not relevant.

      You declared your AoA as a lexical, outside of any braces, so it is visible from that declaration until the end of the file. If it were inside braces, it would only be visible to the closing brace. If you want it to be visible outside the file, you should declare it with our.

      We're not really tightening our belts, it just feels that way because we're getting fatter.