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


in reply to wants to export global variable

You can't change the environment of the calling process directly. You would have to arrange for that process to call your perl program and stuff whatever it prints into the environment variable of your choice

You can change the environment variables of any child process you call:

$ENV{'hello'}='goodbye'; system('echo greetings from the shell, $hello');

Much of this has been discussed in other threads. Here is one, Set shell environment variables from within a perl script