$ENV{DISPLAY} = "10.16.119.3:0.0"; `another_program`; #### print "export DISPLAY=$display_value\n"; #### #!/usr/bin/bash # Create a temporary shell script using perl perl_program.pl > /tmp/setenv.$$ # source the temporary script and then remove it . /tmp/setenv.$$ rm -f /tmp/setenv.$$ # run another program with the modified environment another_program