<?xml version="1.0" encoding="windows-1252"?>
<node id="1007524" title="Re: Who modifies $ENV{PATH}?" created="2012-12-06 05:35:49" updated="2012-12-06 05:35:49">
<type id="11">
note</type>
<author id="757127">
tobyink</author>
<data>
<field name="doctext">
&lt;p&gt;You could try adding the following right at the top of your script. (Even add it before &lt;c&gt;use strict&lt;/c&gt; - before everything else except perhaps the &lt;c&gt;#!&lt;/c&gt; line.)&lt;/p&gt;

&lt;c&gt;
BEGIN {
	package Tie::Env::Warn;
	use Carp qw(cluck);
	use Tie::Hash;
	our @ISA = 'Tie::StdHash';
	sub STORE {
		my ($self, $key, $value) = @_;
		cluck "Modification of \$ENV{$key}!";
		$self-&gt;SUPER::STORE($key, $value);
	}
	tie %ENV, __PACKAGE__;
};
&lt;/c&gt;

&lt;p&gt;That will print out a warning including a stack trace (which shows line numbers, etc) whenever &lt;c&gt;%ENV&lt;/c&gt; values are assigned. If that doesn't help, then you could also try hooking the &lt;c&gt;DELETE&lt;/c&gt; and &lt;c&gt;CLEAR&lt;/c&gt; methods (the example above just hooks &lt;c&gt;STORE&lt;/c&gt;).&lt;/p&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-757127"&gt;
&lt;small&gt;&lt;small&gt;
&lt;tt&gt;perl -E'sub Monkey::do{say$_,for@_,do{($monkey=&amp;#x5B;caller(0)]-&gt;&amp;#x5B;3])=~s{::}{ }and$monkey}}"Monkey say"-&gt;Monkey::do'
&lt;/tt&gt;&lt;/small&gt;&lt;/small&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1007509</field>
<field name="parent_node">
1007509</field>
</data>
</node>
