in reply to How to change a script's environment after the script is already run, based on shell sourcing ?

It seems to me the answers given so far are too complicated because everyone wants to write Perl where they don't need it. You want a shell script instead. Source the environment file to set up the environment, then start the Perl script.

#!/bin/sh source /etc/profiles/bashrc.ora.v.10 perl program.pl

And, if your Perl program is already running and the profile file has changed, you can exec the script again, effectively starting fresh.

--
brian d foy <brian@stonehenge.com>
Subscribe to The Perl Review
  • Comment on Re: How to change a script's environment after the script is already run, based on shell sourcing ?
  • Download Code

Replies are listed 'Best First'.
Re^2: How to change a script's environment after the script is already run, based on shell sourcing ?
by Tanktalus (Canon) on Oct 13, 2006 at 03:28 UTC

    Minor point: I'd add "exec" in front of "perl". Reduces overhead a minor bit. It's sorta like the the goto &NAME in Perl, but bigger.