1N/Aprint "#1 :$x: eq :x:\n";
1N/Aif ($x eq 'x') {
print "ok 1\n";}
else {
print "not ok 1\n";}
1N/A$x = $#;
# this is the register $# 1N/Aif ($x eq '') {
print "ok 2\n";}
else {
print "not ok 2\n";}
1N/Aif ($x eq '-1') {
print "ok 3\n";}
else {
print "not ok 3\n";}
1N/Aif (length($x) == 1) {
print "ok 4\n";}
else {
print "not ok 4\n";}
1N/A/^/ && (print "ok 5\n"); 1N/Aif (!$@) {
print "ok 6\n";}
else {
print "not ok 6 $@\n";}
1N/Aeval '$foo = 123+123.4+123e4+123.4E5+123.4e+5+.12;';
1N/Aif ($foo eq 2591024652) {
print "ok 7\n";}
else {
print "not ok 7 :$foo:\n";}
1N/A# previous line intentionally left blank. 1N/Aprint <<E1
eq "foo\n\n" ? "ok 19\n" : "not ok 19\n"; 1N/Aprint <<E1
eq "foo\n\n" ? "ok 20\n" : "not ok 20\n"; 1N/Aprint "${foo}{$bar}" eq "FOO{BAR}" ?
"ok 22\n" :
"not ok 22\n";
1N/Aprint "${foo{$bar}}" eq "BAZ" ?
"ok 23\n" :
"not ok 23\n";
1N/Aprint "FOO:" =~ /
$foo[:]/ ?
"ok 24\n" :
"not ok 24\n";
1N/Aprint "ABC" =~ /^
$ary[$A]$/ ?
"ok 25\n" :
"not ok 25\n";
1N/Aprint "FOOZ" =~ /^
$foo[$A-Z]$/ ?
"ok 26\n" :
"not ok 26\n";
1N/Aprint "d" =~ /^$X[-
1]$/ ?
"ok 27\n" :
"not ok 27\n";
1N/Aprint "a1" !~ /^$X[-
1]$/ ?
"ok 28\n" :
"not ok 28\n";
1N/Aprint (((q{{\{\(}} . q{{\)\}}}) eq '{{\(}{\)}}') ? "ok 29\n" : "not ok 29\n");
1N/A# Tests for new extended control-character variables 1N/A if ($ {^XY} != 23) { print "not " } 1N/A# Does the syntax where we use the literal control character still work? 1N/A if (eval "\$ {\cX}" != 17 or $@) { print "not " } 1N/A eval "\$\cQ = 24"; # Literal control character 1N/A if ($@ or ${"\cQ"} != 24) { print "not " } 1N/A if ($^Q != 24) { print "not " } # Control character escape sequence 1N/A# Does the old UNBRACED syntax still do what it used to? 1N/A if ("$^XY" ne "17Y") { print "not " } 1N/A $ {"\cQ\cXX"} = 119; 1N/A $^Q = 5; # This should be an unused ^Var. 1N/A # The second caret here should be interpreted as an xor 1N/A if (($^Q^XX) != 3) { print "not " } 1N/A# if (($N ^ XX()) != 3) { print "not " } 1N/A # These next two tests are trying to make sure that 1N/A # $^FOO is always global; it doesn't make sense to `my' it. 1N/A# print "($@)\n" if $@; 1N/A eval 'my $ {^XYZ};'; 1N/A print "not " unless index ($@, 'Can\'t use global $^XYZ in "my"') > -1; 1N/A# print "($@)\n" if $@; 1N/A# Now let's make sure that caret variables are all forced into the main package. 1N/A $ {^M} = 'Someother 3'; 1N/A# see if eval '', s///e, and heredocs mix 1N/A local $_ = "not ok "; 1N/A s/^not /<<EOT/e and T '^main:\(eval \d+\):2$', $test++; 1N/A# tests 47--51 start here 1N/A# tests for new array interpolation semantics: 1N/A# arrays now *always* interpolate into "..." strings. 1N/A# 20000522 MJD (mjd@plover.com) 1N/A eval(q(">@nosuch<" eq "><")) || print "# $@", "not "; 1N/A # Look at this! This is going to be a common error in the future: 1N/A eval(q("fred@example.com" eq "fred.com")) || print "# $@", "not "; 1N/A # Let's make sure that normal array interpolation still works right 1N/A # For some reason, this appears not to be tested anywhere else. 1N/A print +((">@a<" eq ">1 2 3<") ? '' : 'not '), "ok $test\n"; 1N/A eval(q{@nosuch = ('a', 'b', 'c'); ">@nosuch<" eq ">a b c<"}) 1N/A || print "# $@", "not "; 1N/A # This isn't actually a lex test, but it's testing the same feature 1N/A || print "# $@", "not "; 1N/A# => should only quote foo::bar if it isn't a real sub. AMS, 20010621