Wiggins has asked for the wisdom of the Perl Monks concerning the following question:
With the 'if' clause in the code, all is well as long as there is such an environment value. But if the possible value isn't in the environment (e.g. EGGSHELL is not defined):use Env; use strict; if ( defined $SHELL) { print "$SHELL\n"; } root@whitebox:/tmp# perl testEnv.pl /bin/bash
use Env; use strict; if ( defined $EGGSHELL) { print "$EGGSHELL\n"; } root@whitebox:/tmp# perl testEnv.pl Global symbol "$EGGSHELL" requires explicit package name at testEnv.pl + line 4. Execution of testEnv.pl aborted due to compilation errors.
What is the correct explicit package, and if Env, what is the correct syntax?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't be 'strict' with Env ??
by ikegami (Patriarch) on Jan 24, 2007 at 20:52 UTC | |
|
Re: Can't be 'strict' with Env ??
by liverpole (Monsignor) on Jan 24, 2007 at 20:50 UTC | |
|
Re: Can't be 'strict' with Env ??
by jettero (Monsignor) on Jan 24, 2007 at 20:45 UTC | |
|
Re: Can't be 'strict' with Env ??
by Zaxo (Archbishop) on Jan 24, 2007 at 20:45 UTC | |
|
Re: Can't be 'strict' with Env ??
by Wiggins (Hermit) on Jan 25, 2007 at 14:03 UTC |