When calling subroutines using the &, you should almost always use () also: &remove();. Not doing so gives the called routine access to the caller's @_; that is, a shift() in remove would take away one of direct's arguments. This can lead to hard-to-find bugs. &subname; without parens is only useful as an optimization in rare circumstances.sub directs { ... &remove; }
Alternatively, drop the & too, and either place the body of your subs before they are called, or use a forward declaration: sub remove; sub declare;
In reply to Re: using a subroutine
by ysth
in thread using a subroutine
by xjlittle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |