start page | rating of books | rating of authors | reviews | copyrights

Programming Perl

Programming PerlSearch this book
Previous: 7.2.59 strict - Restrict Unsafe Constructs Chapter 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 Constructs Programming Perl Next: 7.2.61 Symbol - Generate Anonymous Globs; Qualify Variable Names
7.2.59 strict - Restrict Unsafe Constructs Book Index 7.2.61 Symbol - Generate Anonymous Globs; Qualify Variable Names