in reply to setting perl ENV from file

Is your file one that can be sourced in the shell? Then use the following code near the top of your program (assuming you use something like Bourne shell, Bash, Korn shell, POSIX shell, ...).
my $ENVIRONMENT = "/some/file/with/environment/variables/"; if (@ARGV && $ARGV [0] eq '--sourced_environment') { shift; } else { if (-f $ENVIRONMENT) { # # Now we perform a double exec. The first exec gives us a +shell, # allowing us the source the file with the environment var +iables. # Then, from within the shell we re-exec ourself - but wit +h an # argument that will prevent us from going into infinite r +ecursion. # # We cannot do a 'system "source $ENVIRONMENT"', because # environment variables are not propagated to the parent. # # Note the required trickery to do the appropriate shell q +uoting # when passing @ARGV back to ourselves. # # Also note that the program shouldn't normally be called +with # '--sourced_environment' - if so, pick something else. # @ARGV = map {s/'/'"'"'/g; "'$_'"} @ARGV; exec << " --"; source '$ENVIRONMENT' exec $0 --sourced_environment @ARGV; -- die "This should never happen."; } }

Abigail