split returns a list, to make an array you need 'square' , 'brackets'
Well, this:
gives you an array, on which you can use an index to find one element, for example:(split /$separator/, $line)
On the other hand, this:my $third_elmnt = (split /$separator/, $line)[2];
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.[split /$separator/, $line];
You probably know all that, I was only objecting to the fact that this was not made very clear in my humble opinion.
In reply to Re^4: Problem with traversing a two dimensional array (to create an arrayref use [ ] )
by Laurent_R
in thread Problem with traversing a two dimensional array
by SiNoEvol
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |