in reply to Multi-Dimensional Arrays and Array References

You should (re-)read perlreftut and perllol while possibly having copies of Data::Dumper output of your samples' contents handy. That being said when you're referencing a single element of an array having a leading @ sigil is a good sign you're doing something wrong.

You're also probably confusing yourself trying to directly compare an array reference in the scalar $table against an actual array @table2. When you initialize my @table2 = [ [7, 8, 9], ... ] what you're actually doing is putting a reference to an anonymous array into the 0th (first) element (i.e. you're setting $table2[0] to point to an arrayref) so that's where your extra level of indexen comes in.

Edit: perldsc might also be useful for more examples. Also tweaked wording.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: Multi-Dimensional Arrays and Array References
by Leudwinus (Scribe) on Nov 16, 2020 at 18:37 UTC

    Hi Fletch,

    You are correct that I am very confused about

    • the difference between
    • how to work with, and
    • how to compare

    arrays and array references but the links to the Perl documentation pages you provided look quite useful. Thank you for directing me that way.

    I really love how perldoc allows you to browse those pages directly on the command line too!

    Gratias tibi ago
    Leudwinus