if (fork == 0) { # create a subprocess $ENV{myvariablename} = "desired variable value"; # set the variable ... exec("/path/to/program","some","program","arguments"); # run the program }