use Test2::V0; sub mybag { my @ar = @_; bag { item $_ for @ar ; end } } is(\@array1, mybag(@array2));