mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-09 02:56:25 +00:00
array_intersect: allow passing list of references for convenience
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
26a68cf6d8
commit
3982313e8d
@ -1654,6 +1654,10 @@ sub dev_t_minor($) {
|
|||||||
sub array_intersect {
|
sub array_intersect {
|
||||||
my ($arrays) = @_;
|
my ($arrays) = @_;
|
||||||
|
|
||||||
|
if (!ref($arrays->[0])) {
|
||||||
|
$arrays = [ grep { ref($_) eq 'ARRAY' } @_ ];
|
||||||
|
}
|
||||||
|
|
||||||
return [] if scalar(@$arrays) == 0;
|
return [] if scalar(@$arrays) == 0;
|
||||||
return $arrays->[0] if scalar(@$arrays) == 1;
|
return $arrays->[0] if scalar(@$arrays) == 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user