When you shell out of Perl, the environment is set using the %ENV hash. You can alter this hash within your script, and then each shell call will use your altered %ENV. When the script ends, the environment will revert to whatever it was before your script. (unless you edit it some other way.)
So instead of calling your init routine, write it into your perl script.