7 print "#1 :$x: eq :x:\n";
8 if ($x eq 'x') {print "ok 1\n";} else {print "not ok 1\n";}
10 $x = $#; # this is the register $#
12 if ($x eq '') {print "ok 2\n";} else {print "not ok 2\n";}
16 if ($x eq '-1') {print "ok 3\n";} else {print "not ok 3\n";}
20 if (length($x) == 1) {print "ok 4\n";} else {print "not ok 4\n";}
25 /^/ && (print "ok 5\n");
29 if (!$@) {print "ok 6\n";} else {print "not ok 6 $@\n";}
31 eval '$foo = 123+123.4+123e4+123.4E5+123.4e+5+.12;';
33 $foo = int($foo * 100 + .5);
34 if ($foo eq 2591024652) {print "ok 7\n";} else {print "not ok 7 :$foo:\n";}
45 eval <<\EOE, print $@;
56 print <<`EOS` . <<\EOF;
75 # previous line intentionally left blank.
77 print <<E1 eq "foo\n\n" ? "ok 19\n" : "not ok 19\n";
83 print <<E1 eq "foo\n\n" ? "ok 20\n" : "not ok 20\n";
96 print "$foo{$bar}" eq "BAZ" ? "ok 21\n" : "not ok 21\n";
98 print "${foo}{$bar}" eq "FOO{BAR}" ? "ok 22\n" : "not ok 22\n";
99 print "${foo{$bar}}" eq "BAZ" ? "ok 23\n" : "not ok 23\n";
101 print "FOO:" =~ /$foo[:]/ ? "ok 24\n" : "not ok 24\n";
102 print "ABC" =~ /^$ary[$A]$/ ? "ok 25\n" : "not ok 25\n";
103 print "FOOZ" =~ /^$foo[$A-Z]$/ ? "ok 26\n" : "not ok 26\n";
106 ($X, @X) = qw(a b c d);
107 print "d" =~ /^$X[-1]$/ ? "ok 27\n" : "not ok 27\n";
108 print "a1" !~ /^$X[-1]$/ ? "ok 28\n" : "not ok 28\n";
110 print (((q{{\{\(}} . q{{\)\}}}) eq '{{\(}{\)}}') ? "ok 29\n" : "not ok 29\n");
113 $foo = "not ok 30\n";
114 $foo =~ s/^not /substr(<<EOF, 0, 0)/e;
119 # Tests for new extended control-character variables
126 if ($ {^XY} != 23) { print "not " }
129 # Does the syntax where we use the literal control character still work?
130 if (eval "\$ {\cX}" != 17 or $@) { print "not " }
133 eval "\$\cN = 24"; # Literal control character
134 if ($@ or ${"\cN"} != 24) { print "not " }
136 if ($^N != 24) { print "not " } # Control character escape sequence
139 # Does the old UNBRACED syntax still do what it used to?
140 if ("$^XY" ne "17Y") { print "not " }
145 $^N = 5; # This should be an unused ^Var.
147 # The second caret here should be interpreted as an xor
148 if (($^N^XX) != 3) { print "not " }
150 # if (($N ^ XX()) != 3) { print "not " }
153 # These next two tests are trying to make sure that
154 # $^FOO is always global; it doesn't make sense to `my' it.
158 print "not " unless index ($@, 'Can\'t use global $^X in "my"') > -1;
160 # print "($@)\n" if $@;
163 print "not " unless index ($@, 'Can\'t use global $^XYZ in "my"') > -1;
165 # print "($@)\n" if $@;
167 # Now let's make sure that caret variables are all forced into the main package.
170 $ {^Nostril} = 'Someother 2';
171 $ {^M} = 'Someother 3';
173 print "not " unless $^N eq 'Someother';
175 print "not " unless $ {^Nostril} eq 'Someother 2';
177 print "not " unless $ {^M} eq 'Someother 3';
183 # see if eval '', s///e, and heredocs mix
186 my ($where, $num) = @_;
187 my ($p,$f,$l) = caller;
188 print "# $p:$f:$l vs /$where/\nnot " unless "$p:$f:$l" =~ /$where/;
196 local $_ = "not ok ";
198 s/^not /<<EOT/e and T '^main:\(eval \d+\):2$', $test++;
201 print $_, $test++, "\n";
202 T('^main:\(eval \d+\):6$', $test++);
204 T('^main:plunk:1$', $test++);
206 print "# $@\nnot ok $test\n" if $@;
207 T '^main:plink:53$', $test++;