|We don't bite newbies here... much|
Thoughts on the magicality of @_ and $_by rinceWind (Monsignor)
|on Jun 28, 2002 at 18:42 UTC||Need Help??|
rinceWind has asked for the wisdom of the Perl Monks concerning the following question:
broquaint's recent reply to a discussion on programming style, has set me thinking.
So, if you want modifiable scalar parameters, you can change them inside a sub by using $_, $_ etc. as lvalues without resorting to references. Interesting.
Also, I am reminded of how $_ gets bound to successive members of an array:
Is the same true if you use an intermediate variable - does it get aliased, or merely assigned? Apologies: I don't have access to a machine running Perl at the moment
Also I'm wondering about the future of all this. What of behaviour in Perl 6? Coming back to the first scenario, I hear that Perl 6 will be getting some Ruby features. Does this include passing parameters by name and hence Jensen's device?
Note: magicality - this might be a new term I am coining. Magicality bears as much relation to magic as sexuality does to sex.