http://www.perlmonks.org?node_id=90776


in reply to Multidimensional Arrays

The syntax @array->[0] is unsupported; it was never really intended to work in the first place.

The perldelta that comes with 5.6.1 explains:

Arrow operator and arrays When the left argument to the arrow operator "->" is an array, or the "scalar" operator operating on an array, the result of the operation must be considered erroneous. For example: @x->[2] scalar(@x)->[2] These expressions will get run-time errors in some future release of Perl.
I think that your tutorial is somewhat misleading, because you seem to suggest that @array->[0] is a standard idiom.

Replies are listed 'Best First'.
Re: Multidimensional Arrays
by CharlesClarkson (Curate) on Jun 23, 2001 at 11:14 UTC

    Well, I haven't gotten aroud to installing 5.6.1 and I probably would have missed this. Would you mind rereading the tutorial. I edited it with your comment in mind and would like to know if it screwed up the logical flow.


    Thank You,
    Charles
      great tutorial. I was really struggling trying to grasp the concept, I had read everything I could, but nothing seemed to sink in until I read this article! Charles, you have a gift. I almost did not read the article due to the name, perhaps you could mention reference. I wish some of the posts on why NOT to use symbolic references had a link to this article... Another intersting chapter might be using hashes in a reference.
        I now have complete multidimentional wisdom, and it took less than 10 minutes to comprehend (incl intermissions). I'm not saying that everyone elses tutorials are rubbish. I just believe some people tune into certain styles of writing, and this is one style I can tune into. Well done!!