{ local %ENV = %ENV; ## make your additions (deletions, changes) here; $ENV{FOO} = 'BAR'; my $pid = open my $pipe, '-|', '/path/to/the/executable', @args or die ...; sleep $someTime; kill KILL, $pid; } ## the changes to %ENV are undone once you reach here