(split /$separator/, $line)
gives you an array, on which you can use an index to find one element, for example:
my $third_elmnt = (split /$separator/, $line)[2];
On the other hand, this:
[split /$separator/, $line];
does not give you an array, but an arrayref i.e. a single scalar. And an arrayref is what you need to oush onto an array if you want to build an AoA.
You probably know all that, I was only objecting to the fact that this was not made very clear in my humble opinion.
|