http://www.perlmonks.org?node_id=932595


in reply to Re^2: Source command in perl script
in thread Source command in perl script

A parent process cannot inherit from a process it spawns.

You can however set the environment within the Perl script and then the system call will inherit it or you could run the db2profile scipt prior to running the Perl script and then everything would inherit it.

Rewriting as Perl

$ENV{PATH}="$ENV{PATH}:/opt/db2/bin" ...
Or calling everything from a shell script...
#!/bin/sh . /home/db2inst1/sqllib/db2profile /home/db2instl/bin/stop_db.pl # Or whatever the script is called

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."