You could probably use an array of arrays (AoA), an array of hashes (AoH), an hash or arrays (HoA) or a hash of hashes (HoH). Your could even use 2 arrays, or 2 hashes, or an array and a hash, but that is sort of less interesting. You could even use a simple array (or a simple hash) and concatenate the Boolean and the int into it, but that starts to be quite ugly.

I was under the impression you couldn't place an array inside another array with Perl, am I perhaps incorrect in this assumption? I only say this, because I actually considered doing that using that in a similar sense, but after some research, found that Perl doesn't really like doing that.

Technically, you are correct. An array value can only hold a scalar variable.

However, there are a couple of ways you can work around that. The most common is references. Instead of storing an array inside of another array, you store array references (which are scalar values) in your array.

Your are right, you can't really place an array inside another array with Perl, but you can put in an array a reference toward another array. And you can do it in a way that you don't have to be explicit about the existence of a reference, it really looks like a two-dimensional array.

Suppose you want to store in an array the full name and the abbreviated name of each of the months. Your could do this in various syntactic ways as follows:

The dump shows that the @month array contains 4 references to arrays (the 'ARRAY(0x20381390)' part), and that each of these arrays contain two elements, the month full and short names. And you can just print one element as follows:

print $month[3][1]; # prints "Apr"

So you could almost use all this without even knowing about references. Except that if you don't understand the underlying references, you will not be able to understand what's happening when something goes wrong (say, when the compiler complains about some illegal construct or, worse, when your program is not doing what you want because your data is not quite what you think).

In brief, you can in principle construct an entire program with AoA (or AoH, HoA or HAH) without ever using a syntax that explicitly shows that the top-level array contains in fact references to other (anonymous) arrays. But you still need to know and understand this reference shebang if you are going to use it for anything else than an extremely simple program.