Like just about every other Perl construct, there are times when it makes sense to use &f and others when it doesn't. This construct reuses the current @_ as it's argument list. This can be handy if you want the called function to have some effect on the caller's argument list which the caller will subsequently need to make use of. In most other contexts, it is probaby more clear to f(@_) explicitly so that what is happening is more clear. The effiency differences between &f and f(@_) are negligible except in the most extreme cases, though f(@_) does do extra work to construct a new @_ for f to use.
Your coworker's reference or 'argument checking' is probably referring to the fact that when you call a function as &f then any prototype it has is ignored. This isn't relevant if you have not established a prototype for the function in question, so your coworkers criticism does not apply. It is probably a bad idea to call a prototyped functions as &f as confusion is indeed likely to occur.
--DrWhy
"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.