1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
use warnings;
use strict;
use Test::More tests => 28;
our @t = qw(a b c d e f);
our $r = \@t;
our($i3, $i4, $i8, $i9) = (3, 4, 8, 9);
our @i4 = (3, 3, 3, 3);
use Array::Base +3;
is $t[3], "a";
is $t[4], "b";
is $t[8], "f";
is $t[9], undef;
is_deeply [ scalar $t[4] ], [ "b" ];
is_deeply [ $t[4] ], [ "b" ];
is $r->[3], "a";
is $r->[4], "b";
is $r->[8], "f";
is $r->[9], undef;
is_deeply [ scalar $r->[4] ], [ "b" ];
is_deeply [ $r->[4] ], [ "b" ];
is $t[$i3], "a";
is $t[$i4], "b";
is $t[$i8], "f";
is $t[$i9], undef;
is_deeply [ scalar $t[$i4] ], [ "b" ];
is_deeply [ $t[$i4] ], [ "b" ];
is_deeply [ scalar $t[@i4] ], [ "b" ];
is_deeply [ $t[@i4] ], [ "b" ];
is $r->[$i3], "a";
is $r->[$i4], "b";
is $r->[$i8], "f";
is $r->[$i9], undef;
is_deeply [ scalar $r->[$i4] ], [ "b" ];
is_deeply [ $r->[$i4] ], [ "b" ];
is_deeply [ scalar $r->[@i4] ], [ "b" ];
is_deeply [ $r->[@i4] ], [ "b" ];
1;
|