perl 5.0 alpha 9
[p5sagit/p5-mst-13.2.git] / t / base / lex.t
CommitLineData
8d063cd8 1#!./perl
2
79072805 3# $RCSfile: lex.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:04 $
8d063cd8 4
79072805 5print "1..24\n";
8d063cd8 6
79072805 7$x = 'x';
8d063cd8 8
79072805 9print "#1 :$x: eq :x:\n";
10if ($x eq 'x') {print "ok 1\n";} else {print "not ok 1\n";}
8d063cd8 11
12$x = $#; # this is the register $#
13
14if ($x eq '') {print "ok 2\n";} else {print "not ok 2\n";}
15
16$x = $#x;
17
18if ($x eq '-1') {print "ok 3\n";} else {print "not ok 3\n";}
19
20$x = '\\'; # ';
21
22if (length($x) == 1) {print "ok 4\n";} else {print "not ok 4\n";}
a559c259 23
24eval 'while (0) {
25 print "foo\n";
26}
27/^/ && (print "ok 5\n");
28';
29
30eval '$foo{1} / 1;';
79072805 31if (!$@) {print "ok 6\n";} else {print "not ok 6 $@\n";}
378cc40b 32
33eval '$foo = 123+123.4+123e4+123.4E5+123.4e+5+.12;';
34
35$foo = int($foo * 100 + .5);
87250799 36if ($foo eq 2591024652) {print "ok 7\n";} else {print "not ok 7 :$foo:\n";}
a687059c 37
38print <<'EOF';
39ok 8
40EOF
41
42$foo = 'ok 9';
43print <<EOF;
44$foo
45EOF
46
47eval <<\EOE, print $@;
48print <<'EOF';
49ok 10
50EOF
51
52$foo = 'ok 11';
53print <<EOF;
54$foo
55EOF
56EOE
57
58print <<`EOS` . <<\EOF;
59echo ok 12
60EOS
61ok 13
62EOF
63
64print qq/ok 14\n/;
65print qq(ok 15\n);
66
67print qq
68ok 16\n
69;
70
71print q<ok 17
72>;
73
74print <<; # Yow!
75ok 18
76
77# previous line intentionally left blank.
79072805 78
79$foo = FOO;
80$bar = BAR;
81$foo{$bar} = BAZ;
82$ary[0] = ABC;
83
84print "$foo{$bar}" eq "BAZ" ? "ok 19\n" : "not ok 19\n";
85
86print "${foo}{$bar}" eq "FOO{BAR}" ? "ok 20\n" : "not ok 20\n";
87print "${foo{$bar}}" eq "BAZ" ? "ok 21\n" : "not ok 21\n";
88
89print "FOO:" =~ /$foo[:]/ ? "ok 22\n" : "not ok 22\n";
90print "ABC" =~ /^$ary[$A]$/ ? "ok 23\n" : "not ok 23\n";
91print "FOOZ" =~ /^$foo[$A-Z]$/ ? "ok 24\n" : "not ok 24\n";