array_intersect: allow passing list of references for convenience

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-07-23 09:12:51 +02:00
parent 26a68cf6d8
commit 3982313e8d

View File

@ -1654,6 +1654,10 @@ sub dev_t_minor($) {
sub array_intersect {
my ($arrays) = @_;
if (!ref($arrays->[0])) {
$arrays = [ grep { ref($_) eq 'ARRAY' } @_ ];
}
return [] if scalar(@$arrays) == 0;
return $arrays->[0] if scalar(@$arrays) == 1;