Programming Perl

Programming PerlSearch this book
Previous: 7.2.59 strict - Restrict Unsafe ConstructsChapter 7
The Standard Perl Library
Next: 7.2.61 Symbol - Generate Anonymous Globs; Qualify Variable Names
 

7.2.60 subs - Predeclare Subroutine Names

use subs qw(sub1 sub2 sub3);
sub1 $arg1, $arg2;

This predeclares the subroutines whose names are in the list, allowing you to use them without parentheses even before they're defined. It has the additional benefit of allowing you to override built-in functions, since you may only override built-ins via an import, and this pragma does a pseudo-import.

See also the vars module.


Previous: 7.2.59 strict - Restrict Unsafe ConstructsProgramming PerlNext: 7.2.61 Symbol - Generate Anonymous Globs; Qualify Variable Names
7.2.59 strict - Restrict Unsafe ConstructsBook Index7.2.61 Symbol - Generate Anonymous Globs; Qualify Variable Names