#!./perl
BEGIN {
chdir 't' if -d 't';
}
print "1..36\n";
$a = 1+1;
undef $a;
$a = "hi";
$a = $b;
$a = shift(@ary);
$a = shift(@ary);
@ary = (1);
%ary = (1,1);
&foo || print "not ok 19\n";
eval { undef $1 };
eval { $1 = undef };
{
}
{
}
{
# [perl #17753] segfault when undef'ing unquoted string constant
eval 'undef tcp';
print $@ =~ /^Can't modify constant item/ ? "ok 28\n" : "not ok 28\n";
}
# bugid 3096
# undefing a hash may free objects with destructors that then try to
# modify the hash. To them, the hash should appear empty.
$test = 29;
%hash = (
key1 => bless({}, 'X'),
key2 => bless({}, 'X'),
);
undef %hash;
sub X::DESTROY {
print "not " if keys %hash; print "ok $test\n"; $test++;
print "not " if values %hash; print "ok $test\n"; $test++;
print "not " if each %hash; print "ok $test\n"; $test++;
}