Commit | Line | Data |
---|---|---|
36b2db7e | 1 | use warnings; no warnings 'deprecated'; |
b82b06b8 FC |
2 | use strict; |
3 | ||
4 | use Test::More tests => 33; | |
5 | ||
6 | our @t = qw(a b c d e f); | |
7 | our $r = \@t; | |
8 | our($i3, $i4, $i8, $i9) = (3, 4, 8, 9); | |
9 | our @i4 = (3, 3, 3, 3); | |
10 | ||
11 | $[ = 3; | |
12 | ||
13 | is $t[3], "a"; | |
14 | is $t[4], "b"; | |
15 | is $t[8], "f"; | |
16 | is $t[9], undef; | |
17 | is_deeply [ scalar $t[4] ], [ "b" ]; | |
18 | is_deeply [ $t[4] ], [ "b" ]; | |
19 | ||
20 | is $t[2], 'f'; | |
21 | is $t[-1], 'f'; | |
22 | is $t[1], 'e'; | |
23 | is $t[-2], 'e'; | |
24 | ||
25 | { | |
26 | $[ = -3; | |
27 | is $t[-3], 'a'; | |
28 | } | |
29 | ||
30 | is $r->[3], "a"; | |
31 | is $r->[4], "b"; | |
32 | is $r->[8], "f"; | |
33 | is $r->[9], undef; | |
34 | is_deeply [ scalar $r->[4] ], [ "b" ]; | |
35 | is_deeply [ $r->[4] ], [ "b" ]; | |
36 | ||
37 | is $t[$i3], "a"; | |
38 | is $t[$i4], "b"; | |
39 | is $t[$i8], "f"; | |
40 | is $t[$i9], undef; | |
41 | is_deeply [ scalar $t[$i4] ], [ "b" ]; | |
42 | is_deeply [ $t[$i4] ], [ "b" ]; | |
43 | is_deeply [ scalar $t[@i4] ], [ "b" ]; | |
44 | is_deeply [ $t[@i4] ], [ "b" ]; | |
45 | ||
46 | is $r->[$i3], "a"; | |
47 | is $r->[$i4], "b"; | |
48 | is $r->[$i8], "f"; | |
49 | is $r->[$i9], undef; | |
50 | is_deeply [ scalar $r->[$i4] ], [ "b" ]; | |
51 | is_deeply [ $r->[$i4] ], [ "b" ]; | |
52 | is_deeply [ scalar $r->[@i4] ], [ "b" ]; | |
53 | is_deeply [ $r->[@i4] ], [ "b" ]; | |
54 | ||
55 | ||
56 | 1; |