Hence I'm a bit puzzled as to why I explicitly have to use an array as per your example. Is this better programming practice ?
Yes, it is - and precisely because you are puzzled :-)
As I said above, split by default splits into the array @_ whose first element is $_[0] - and it's a deprecated usage because it leads people to be puzzled, and because @_ also is the argument array inside subroutines; so using implicit split inside subs is probably a bad idea.
In reply to Re^3: Access elements of $_
by shmem
in thread Access elements of $_
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |