[Israel.pm] Query regarding executing a shell script in perl

Vijay Goutham vijay.rajkumar at gmail.com
Mon Feb 14 02:22:29 PST 2005


Hi All,
   I have a perl process.  The perl process need to do the following,
   
   a.  Execute a shell script (ksh) which sets some environment variables 
       (E.g. the shell script contains a set of export statements like,
          export CLASS=10
          export ROOM=4
          etc..
        )
   
   b.   A set of perl functions which uses these environment variables
(CLASS, ROOM).
        (E.g.  print $ENV{'CLASS'}; )
        
   Now the problem i face is,
   
   I call the shell script (say set_env), using either
   
   i)  system("setenv"); (or)
   ii) `setenv` (using backtick)
   
   But the issue is, after executing the system (or `setenv`) the
environment variables are getting lost.
   
   
   Is there anyway of executing the setenv script and ensure that the
variables are set in the current shell, so that my perl functions can
use it?
        
        
Thanks in advance

Vijay



More information about the Perl mailing list