In Perl, every method has aan implicit argument list, which may be empty.
DoinK! :) So, since it is implied - you don't need it.
My orginal code fragment was &print_if_Fatal if (system("netstat -nr") / 256);
Your version print_if_Fatal() if (system("netstat -nr") / 256);
Which is one character longer than my version.
HOWEVER :)
For the sake of readability I am willing to go further and empty prototype them out even if there is no parameter to pass:
sub print_if_Warn; # Prototyped (empty)
# Other code...
# It gets called here... print_if_Warn if (system("nstat -a") / 256);
# Yet Other code...
sub print_if_Warn() { # Defined executable code }
======= Programming Perl 3rd Edition:
6.1. Syntax
To declare a named subroutine without defining it, use one of these forms:
sub NAME sub NAME PROTO sub NAME ATTRS sub NAME PROTO ATTRS
To declare and define a named subroutine, add a BLOCK:
sub NAME BLOCK sub NAME PROTO BLOCK sub NAME ATTRS BLOCK sub NAME PROTO ATTRS BLOCK
To create an anonymous subroutine or closure, leave out the NAME:
sub BLOCK sub PROTO BLOCK sub ATTRS BLOCK sub PROTO ATTRS BLOCK
PROTO and ATTRS stand for the prototype and attributes, each of which is discussed in its own section later in the chapter. They're not so important--the NAME and the BLOCK are the essential parts, even when they're missing.
-Bill- __Sx__________________________________________ http://youve-reached-the.endoftheinternet.org/
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>