system('unset LIBPATH'); doesn't work since unset is a shell command, not a program.
system(q{sh -c 'unset LIBPATH'}); would run the shell command, but it would uselessly change the environment of a shell that exits immediately afterwards.
You want to change the current process's environment. delete $ENV{LIBPATH}; is the way to go. If it doesn't work, maybe because it's being done too late. Try putting it in a BEGIN {} block as near the top of your script as you can.
In reply to Re: replicating the command 'unset LIBPATH' in perl
by ikegami
in thread replicating the command 'unset LIBPATH' in perl
by viffer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |