my $shell_exports='./exports.sh'; make_exports($shell_exports); open3(...); sub make_exports { my $file=shift; for my $line (`sh -c '. $file && env'`) { chomp($line); my ($k,$v)=split(/=/,$line,2); $ENV{$k}=$v if($k && $v); } return 1; }