1use Test::More; 2use strict; use warnings FATAL => 'all'; 3 4use List::Objects::WithUtils 'array'; 5 6my $arr = array(qw/ a ba bb c /); 7 8ok $arr->lastidx(sub { /^b/ }) == 2, 9 'lastidx ok'; 10 11ok $arr->last_index(sub { /^b/ }) == 2, 12 'last_index alias ok'; 13 14ok $arr->last_index(sub { /d/ }) == -1, 15 'negative last_index ok'; 16 17ok array->last_index(sub { 1 }) == -1, 18 'last_index on empty array ok'; 19 20done_testing; 21