in reply to using a subroutine
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;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: using a subroutine
by beable (Friar) on Aug 08, 2004 at 22:57 UTC | |
by ysth (Canon) on Aug 08, 2004 at 23:15 UTC | |
Re^2: using a subroutine
by xjlittle (Beadle) on Aug 10, 2004 at 00:34 UTC |
In Section
Seekers of Perl Wisdom