in reply to Checking if an Array is a Member of an AoA
Depending on what else you're doing with the AoA, you might want to use an array of hashes instead.sub different { my ($h1, $h2) = @_; return 1 unless keys %$h1 == keys %$h2; for (keys %$h1) { return 1 unless exists $h2->{$_}; } return 0; } sub member { my ($a, $aoa) = @_; my %as; undef @as{@$a}; for my $x (@$aoa) { my %bs; undef @bs{@$x}; return 1 unless different \%as, \%bs; } return 0; }
|
|---|