18 is($x // 0, 1, ' // : left-hand operand defined');
21 is($x // 1, 1, ' // : left-hand operand undef');
24 is($x // 0, '', ' // : left-hand operand defined but empty');
27 is(($x err 0), 1, ' err: left-hand operand defined');
30 is(($x err 1), 1, ' err: left-hand operand undef');
33 is(($x err 0), '', ' err: left-hand operand defined but empty');
37 is($x, 1, ' //=: left-hand operand undefined');
40 is($x, 1, ' //=: left-hand operand defined');
44 is($x, '', ' //=: left-hand operand defined but empty');
46 @ARGV = (undef, 0, 3);
47 is(shift // 7, 7, 'shift // ... works');
48 is(shift() // 7, 0, 'shift() // ... works');
49 is(shift @ARGV // 7, 3, 'shift @array // ... works');
51 @ARGV = (3, 0, undef);
52 is(pop // 7, 7, 'pop // ... works');
53 is(pop() // 7, 0, 'pop() // ... works');
54 is(pop @ARGV // 7, 3, 'pop @array // ... works');
56 # Test that various syntaxes are allowed
58 for (qw(getc pos readline readlink undef umask <> <FOO> <$foo> -f)) {
59 eval "sub { $_ // 0 }";
60 is($@, '', "$_ // ... compiles");