Line | |
---|
1 | #!./perl
|
---|
2 |
|
---|
3 | BEGIN {
|
---|
4 | chdir 't' if -d 't';
|
---|
5 | @INC = '../lib';
|
---|
6 | }
|
---|
7 |
|
---|
8 | print "1..4\n";
|
---|
9 |
|
---|
10 | print "not " unless reverse("abc") eq "cba";
|
---|
11 | print "ok 1\n";
|
---|
12 |
|
---|
13 | $_ = "foobar";
|
---|
14 | print "not " unless reverse() eq "raboof";
|
---|
15 | print "ok 2\n";
|
---|
16 |
|
---|
17 | {
|
---|
18 | my @a = ("foo", "bar");
|
---|
19 | my @b = reverse @a;
|
---|
20 |
|
---|
21 | print "not " unless $b[0] eq $a[1] && $b[1] eq $a[0];
|
---|
22 | print "ok 3\n";
|
---|
23 | }
|
---|
24 |
|
---|
25 | {
|
---|
26 | # Unicode.
|
---|
27 |
|
---|
28 | my $a = "\x{263A}\x{263A}x\x{263A}y\x{263A}";
|
---|
29 | my $b = scalar reverse($a);
|
---|
30 | my $c = scalar reverse($b);
|
---|
31 | print "not " unless $a eq $c;
|
---|
32 | print "ok 4\n";
|
---|
33 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.