in reply to unsetenv in perl

This is not possible under Unix unless you get some cooperation from your invoking shell. The calling shell is a separate program which you cannot modify. The common approach is to output a shell script from your program and evaluate that shell script in the calling shell:

$ eval $(myscript.pl)