in reply to Re: Run system command in same context of the script itself
in thread Run system command in same context of the script itself

If the requirement of the OP really is to get the ENV of a sub process I'd rather prefer something like this
my $bashcode=<<'__bash__'; . /tmp/src.sh; perl -MData::Dumper -e 'print Dumper \%ENV'; __bash__ my $VAR1; eval qx{bash -c "$bashcode"}; print $VAR1->{MONK}; #> jfroebe

Taken from Re^3: How to "source" a shell file in Perl? (Trojan Dump)

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^3: Run system command in same context of the script itself
by igorle (Initiate) on Apr 10, 2023 at 14:47 UTC
    The requirement is to set the variable and ran a command that utilizes that variable. What i'm doing is setting the vriable which allows connecting to oracle DB, and then connecting to the DB to make some query.