in reply to environment variable

An obvious guess that everyone seems to have missed.

Are you by any chance calling the Perl program from within a shell script and then hoping to change the environment variable?

If so then you are SoL. As Perl is a subprocess it cannot set its parent environment. You need to use export since export is a shell builtin and not a subprocess. The closest that you can come is something like this:

export foo=`perl script.pl`
In that case whatever the script prints will be inserted into the commandline and can therefore be used to set the environment of the shell.