I just tested Debian Wheezy with Perl 5.14.2 .
Scalar Context - Failure Failure
sub test { my $dir = shift; my $oldDir = cwd(); chdir($dir) or die("Could not chdir() : $!"); my $firstEntry = glob('*'); print "$firstEntry\n"; chdir($oldDir) or die("Could not chdir() : $!"); }
List of contexts (works as expected)
sub test { my $dir = shift; my $oldDir = cwd(); chdir($dir) or die("Could not chdir() : $!"); (my $firstEntry) = glob('*'); print "$firstEntry\n"; chdir($oldDir) or die("Could not chdir() : $!"); }
To return here, glob buffer not reset, even if we are not in the call zone.
With perl 5.22-1, both cases work as expected (scalar context).
Nuxwin
source share