#!/usr/bin/perl # setenv from within perl to effect parent shell # actually parent should be more appropriately # called "adopted" or "step-parent", re execl # there is one little requirement: # you should run this program via shell's exec: # % exec # # this is pure-Perl implementation after Corion's # comment. # set env $ENV{test} = 'TURE'; # ... # this should be the last statement in your script # because nothing else will be executed after that # not even the 'or die ...' die "no shell!" unless defined($ENV{SHELL}); exec($ENV{SHELL}); __END__