Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: groping @_ (judiciously)

by Russ (Deacon)
on Dec 16, 2000 at 00:27 UTC ( [id://46911]=note: print w/replies, xml ) Need Help??


in reply to Pass by reference: is it good form to grope @_?

I have to weigh in against the "silently modify the arguments" approach. Of course good (and very LOUD) documentation can offset most of the danger, but most people don't expect to have arguments modified by a subroutine.

IM(ns)HO, the occasional '\' is a very small price to pay for self-documenting code. If it strikes you as jarring, I think that is all the more reason to use it. You (and the one who maintains your code) will instantly recognize an atypical behavior when you see an unusual syntax in use.

I don't think the @_ trick is evil. There is a time and place to use it, just like the &func construct (re-using the current @_), but it should only be used judiciously.

Russ
Brainbench 'Most Valuable Professional' for Perl

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-18 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found