I need to access the value of a shell variable in a perl script. I can get it if it's an environment variable but not a regular ole shell variable. Consider
% set AAA=Avalue
% setenv BBB=Bvalue
% echo $AAA
Avalue
% echo $BBB
Bvalue
So far, so good. Now, here's a perl script to read them...
#!/usr/bin/env perl
use strict;
print "AAA: ".$ENV{AAA}."\n";
print "BBB: ".$ENV{BBB}."\n";
exit;
When I run it, I get...
AAA:
BBB: Bvalue
How can I get the value of AAA from inside the perl script ?
Thanks in Advance
setonly sets environment variables for the current shell, and not for sub-shells. You're obviously settingBBBin a different way than you've shown here, or else your example wouldn't work.perl -e'$AAA="Avalue"; $ENV{BBB}="Bvalue"; system("script.pl");? As you should be realizing now, your request makes no sense.