Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Access elements of $_

by shmem (Canon)
on Aug 12, 2010 at 14:29 UTC ( #854690=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Access elements of $_
in thread Access elements of $_

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.


Comment on Re^3: Access elements of $_
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://854690]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2015-07-02 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (27 votes), past polls