ある配列の中に他の配列の要素がまるまる入っているか見るルーチン

ちょっと必要だったんで作りました。

List::Util::firstを使って実装してみました。

use List::Util qw/first/;
use Carp;
sub includes {
    my ($tgt,$checker) = @_;

    confess "tgt not arr ref" unless ref($tgt) eq "ARRAY";
    confess "checker not arr ref" unless ref($checker) eq "ARRAY";
    
    for my $tgt_elem (@$tgt){
        return undef unless first { $tgt_elem eq $_ } @$checker;
    }
    return 1;
}