in reply to Parent Process Environment

Instead of parsing the script, couldn't you just run it, and list the environment values at the end? You can do that by running another script in the same system or qx call. Something like this (untested — well, the perl oneliner has been tested):
my $env = `envscript.sh && perl -MData::Dumper -e '$Data::Dumper::Ters +e=1; print Dumper \%ENV'`;
You can then eval the string representation of the anonymous hash you captured into $env. You may have to suppress output from the shell script.

And on some platforms, %ENV is magical, so you might not be able to pick up the whole environment. All you can do, is test.