Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Setting the env. / oraperl question

Re: Setting the env. / oraperl question

From: Tad McClellan <tadmc_at_metronet.com>
Date: Fri, 21 May 1999 05:02:00 -0400
Message-ID: <8e73i7.s9f.ln@magna.metronet.com>

[ Followups trimmed. Nothing specific to Oracle in here. ]

Jared Hecker (jhecker_at_iago.nac.net) wrote:

: I am planning a script that will have to:

: 2. change an environmental variable and do some work (loop iteration 1,
: ENV=xxx, run scripts; loop iteration 2, ENV=yyy, run scripts; etc.).

: My question is, when I set an environmental variable from perl and then
: use a system call to run another app (in this case SQL*Plus), does the
: environmental variable setting hold for the called app's environment?

: (If it's convenient, e-mail will reach me faster.)

   If it's convenient, writing four lines of code to see what    happens would have answered your question in less than a minute:



#!/usr/bin/perl -w
use strict;

$ENV{foo} = 'foo';
system 'echo $foo' and die 'problem running system()';

$ENV{foo} = 'FOO';
system 'echo $foo' and die 'problem running system()';


output:

foo
FOO --

    Tad McClellan                          SGML Consulting
    tadmc_at_metronet.com                     Perl programming
    Fort Worth, Texas Received on Fri May 21 1999 - 04:02:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US