Don't use "&" when calling a sub. It's old fashioned and if you don't know its meaning (I doubt you do), you probably shouldn't be using it.
Do *you* know what it does? If so, then your advice surprises me. What it does is prevent a Perl built-in from being called if your subroutine name happens to collide with the name of a Perl built-in. Why should anyone avoid that protection?
Quite the contrary, using & (and parentheses) to call your own subroutines is prudent style, especially if you don't name your subroutines with mixed case and don't care to memorize all of the current Perl keywords (some rather obscure) and predict possible future keywods (and monitor actual creation of new keywords and search all of your scripts when this happens and modify any that now require modification).
It can also be a nice style by visually distinguishing calls to built-ins from calls to user-defined subroutines (which can aid those reading the code by helping them figure out where to find more information on the named routine).
It is good advice to avoid using & without parens to call a subroutine. But that isn't what was done and you didn't even mention this problem. Also note that you should use & without parens with defined or to get a reference to a named subroutine.
- tyeIn reply to Re^2: String concatenation function (&fun)
by tye
in thread String concatenation function
by jonnyr9
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |