[comp.lang.perl] Accessing shell variables in perl.

rmallett@ccs.carleton.ca (Rick Mallett) (04/19/91)

I am writing a perl script which I must, for the time being,
integrate with some csh scripts. For this I need to be able
to examine a shell variable created in a csh parent script,
and I would also like to be able to create a csh variable
from within the perl script, although the latter might be 
asking too much since I don't even know how to do it from
within a csh script. Needless to say I am a rank amateur 
at perl and the solution might indeed be trivial but after
two hours of hacking I haven't managed to trip over the 
answer.

Yes I do realize that I could use environment variables
using $ENV{'xxxx'} or modify the calling script to pass
the variables as command line arguments, but I would 
much rather simply integrate my perl script without 
changing the csh script which invoked it. Any suggestions?
 

worley@compass.com (Dale Worley) (04/20/91)

   From: rmallett@ccs.carleton.ca (Rick Mallett)

   For this I need to be able
   to examine a shell variable created in a csh parent script,
   and I would also like to be able to create a csh variable
   from within the perl script, although the latter might be 
   asking too much since I don't even know how to do it from
   within a csh script.

You can't.  You can't do it with a csh script, either, unless you
'source' it rather than running it.  This is because shell variables
are private to the shell process running the script, and the
sub-script (which is run in a sub-process) can't get at them.

Dale

Dale Worley		Compass, Inc.			worley@compass.com
--
Quality isn't Job 1.  Job 1 is getting the code out the door as soon
as possible with no bugs that the customer will detect in the first 5 seconds
of execution.  And in reality, this is what the customer will reward us
for doing.