in reply to Re: ..."while" i do perl...
in thread ..."while" i do perl...
The answer depends on if you prepend the sub name with & or not.
If you do something like &blah, the sub gets the current contents of @_ as arguments (it's equivalent to blah(@_)).
If you just do blah, then if the sub's been predeclared, it'll be called. Otherwise, it's interpreted as a bareword string. Which is probably not what you want.
I avoid the controversy altogether by using the parenthesis as often as possible, and the ampersand only when dealing with references. I haven't found a good use for &blah, passing @_ by default, except for certain AUTOLOAD routines. It's better to avoid side-effects that might confuse someone else reading my code.
They'll be confused enough already. *sigh*
|
|---|