> -----Original Message-----
> From: Kingsbury, Michael [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 22, 2001 11:07 AM
> To: '[EMAIL PROTECTED]'
> Subject: How to reference env variables.
>
>
> When running a command such as :
>
> `ls -la /some/directory`
>
> there is an envirornment variable called !EXITCODE that I want to
> reference. I already have Use Env in place, but how do I
> keep perl from
> gagging on the bang in the variable name??
Based on a cursory glance at Env.pm, it appears that it will skip
any names in the environment that dont match [A-Za-z_].
You could get at it through the regular %ENV hash:
$ENV{'!EXITCODE'}
This command works on my (HPUX) system:
$ env !EXITCODE=hello perl -e 'print $ENV{q[!EXITCODE]}, "\n"'
hello
Is this variable some artifact of your shell? Are you wanting to
test it following the ls backticks? If so, this isn't going to
work. The shell/ls will be executed in a child process, and the
child cannot affect the parent's environment. If you just want
the exit status from the backtics, you can use Perl's regular
$? variable. Or maybe I'm misunderstanding the whole issue.
(Wouldn't be the first time).
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]