in reply to order of strict and package

Generally, it is:
package PackageName; use strict; use warnings;
I think this has something to do with the package identifies the file, so it should be at the top. Although, multipackage files break this.

Also, if you mix up pragma and other modules by accident, symbols will be imported into MAIN and not __PACKAGE__.

For example:

use strict; use CGI qw/:standard/; package MyPackage;
That probably would be a bad thing as it wouldn't be obvious why CGI functions are being imported into your script's namespace.

Replies are listed 'Best First'.
Re: Re: order of strict and package
by needles (Acolyte) on Jun 01, 2001 at 19:50 UTC
    Oh, yeah. That symbol importing problem would get REAL ugly. : ) I hadn't even considered that.

    Thanks!