On Wed, 27 Jun 2001, Maxim Berlin <[EMAIL PROTECTED]> wrote,

> Hello Dennis,
>
> Tuesday, June 26, 2001, Dennis Fox <[EMAIL PROTECTED]> wrote:
>
> DF>         My difficulty is that I don't understand how to modify @INC to
> DF> include the non-standard locations, so that I don't have to have the user
> DF> supply commandline arguments each time the script is needed.
>
> example:
>
> if ( $OS ne "NT" )
> {
>   BEGIN { unshift(@INC,"/usr/local/etc"); }
>   require "config.backup.pl";
> }

The BEGIN blocks always execute first no matter where you put them.

#!/usr/bin/perl -w

print __LINE__, ": Am I the first?\n";

if (1) {
    BEGIN {
        print __LINE__, ": No, I am the one\n";
    }
    print __LINE__, ": Then I am the last\n";
}

__END__

7: No, I am the one
3: Am I the first?
9: Then I am the last

-- 
s::a::n->http(www.trabas.com)

Reply via email to