10 no warnings 'experimental::refaliasing';
11 use vars qw($data $array $values $hash $errpat);
18 $errpat = qr/Experimental keys on scalar is now forbidden/;
22 'Errors: keys undef throws error'
28 'Errors: keys $undef throws error'
31 is($empty, undef, 'keys $undef does not vivify $undef');
34 like($@, qr/Type of arg 1 to keys must be hash/,
35 'Errors: keys CONSTANT throws error'
40 'Errors: keys qr/foo/ throws error'
43 eval q"keys $hash qw/fo bar/";
45 'Errors: keys $hash, @stuff throws error'
46 ) or print "# Got: $@";
49 $errpat = qr/Experimental values on scalar is now forbidden/;
53 'Errors: values undef throws error'
57 eval q"values $empty";
59 'Errors: values $undef throws error'
62 is($empty, undef, 'values $undef does not vivify $undef');
65 like($@, qr/Type of arg 1 to values must be hash/,
66 'Errors: values CONSTANT throws error'
69 eval "values qr/foo/";
71 'Errors: values qr/foo/ throws error'
74 eval q"values $hash qw/fo bar/";
76 'Errors: values $hash, @stuff throws error'
77 ) or print "# Got: $@";
80 $errpat = qr/Experimental each on scalar is now forbidden/;
84 'Errors: each undef throws error'
90 'Errors: each $undef throws error'
93 is($empty, undef, 'each $undef does not vivify $undef');
96 like($@, qr/Type of arg 1 to each must be hash/,
97 'Errors: each CONSTANT throws error'
102 'Errors: each qr/foo/ throws error'
105 eval q"each $hash qw/foo bar/";
107 'Errors: each $hash, @stuff throws error'
108 ) or print "# Got: $@";
110 use feature 'refaliasing';
115 is "$a $b", "f 7", 'each %hash in list assignment';
117 ($a, $b) = (3, values %h);
118 is "$a $b", "3 7", 'values %hash in list assignment';
119 *a = sub { \@_ }->($a);
121 ($a, $b) = each our @a;
122 is "$a $b", "0 7", 'each @array in list assignment';
124 ($a, $b) = (3, values @a);
125 is "$a $b", "3 7", 'values @array in list assignment';