I have two data structures in Perl:
An array:
my @array2 = ( \"1\", \"2\", \"3\");
for $elem (@array2) {
print $elem.\"\\n\";
}
<
In Perl, arrays and lists are essentially the same thing, but your second example uses neither. Square brackets surround an array reference (a scalar value), and "assigning" a scalar to an array with something like my @array = $scalar is equivalent to my @array = ($scalar). Thus, the only element of @array in your second example is an array reference.