This problem originally occured while running tests for installing Test::Harness, but I've been able to replicate it independently. For reference, the original ticket is available at http://rt.cpan.org/NoAuth/Bug.html?id=6452. The problem is that an local environment variable set in an anonymous block seems to be available to child processes created afterwards using qx(). I have not tested this using system() or fork(). See the example scripts below. test1.pl #!/usr/bin/perl -w use warnings; use strict; my $key = "WANGO"; BLOCK1: { my $val = $ENV{$key}; $val = "undef" unless defined $val; print "In BLOCK1, \$ENV{$key} = [$val]\n"; } BLOCK2: { local $ENV{$key} = "FOTANGO"; my $val = $ENV{$key}; $val = "undef" unless defined $val; print "In BLOCK2, \$ENV{$key} = [$val]\n"; } BLOCK3: { my $val = qx/test2.pl/; $val = "undef" unless defined $val; print "In BLOCK3, \$ENV{$key} = [$val]\n"; print " ... BUT IT SHOULD BE undef!" unless $val eq "undef"; } =cut test2.pl #!/usr/bin/perl -w use strict; my $val = $ENV{WANGO}; $val = "undef" if ! defined $val; print $val; =cut My results on Cygwin are... In BLOCK1, $ENV{WANGO} = [undef] In BLOCK2, $ENV{WANGO} = [FOTANGO] In BLOCK3, $ENV{WANGO} = [FOTANGO] ... BUT IT SHOULD BE undef! On Linux (Perl 5.8.4 on Gentoo with a 2.4.26 kernel), Win32 (ActiveState Build 810), HP-UX (Perl 5.8.0), and Mac OS X (Perl 5.8.0), the results are... In BLOCK1, $ENV{WANGO} = [undef] In BLOCK2, $ENV{WANGO} = [FOTANGO] In BLOCK3, $ENV{WANGO} = [undef] Adding an "$ENV{WANGO} = undef;" to the end of BLOCK2 seems to take care of the problem, but coding this way for just one platform doesn't seem quite right to me. I'm also not sure if this is actually a problem with Perl or an issue with Cygwin itself. Regards, Steve Peters steve@fisharerojo.org