in reply to Can't be 'strict' with Env ??
It behaves this way to avoid misleading error messages. Imagine that use Env; did what you want.
>perl -le "use strict; use Env; print $CONFIG;" Global symbol "$CONFIG" requires explicit package name
You should give a better error message or use a default when the variable isn't specified.
Just specify the variables you wish to import.
>perl -le "use strict; use Env qw( $WINDIR ); print $WINDIR;" E:\WINNT
Or declare the variable.
>perl -le "use strict; use Env; our $WINDIR; print $WINDIR;" E:\WINNT
Of course, there's always $ENV{WINDIR}.
>perl -le "use strict; print $ENV{WINDIR};" E:\WINNT
Update: Added the reason for this behaviour.
|
|---|