From 43e5dff9d8e024afb71c659fd4b041eb2a15c3c4 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 29 Oct 2019 18:20:26 +0000 Subject: [PATCH] TT#69200 Pass the entire list to push in mergearrays() We do not need to add one item at a time, push accepts a list as an argument. Change-Id: I30d81f941c1ce91cb2ed90662cbd9e9daf6fa09f (cherry picked from commit 0991288e50c2c0adfaa03d11972763e8768b80fa) --- lib/NGCP/BulkProcessor/Array.pm | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/NGCP/BulkProcessor/Array.pm b/lib/NGCP/BulkProcessor/Array.pm index 66f183c..6b00508 100644 --- a/lib/NGCP/BulkProcessor/Array.pm +++ b/lib/NGCP/BulkProcessor/Array.pm @@ -24,21 +24,17 @@ our @EXPORT_OK = qw( array_to_map); sub mergearrays { + my ($array_ptr1, $array_ptr2) = @_; - my ($array_ptr1,$array_ptr2) = @_; - my @result = (); - if (defined $array_ptr1 and ref $array_ptr1 eq 'ARRAY') { - foreach my $element (@$array_ptr1) { - push @result,$element; + my @result; + if (defined $array_ptr1 and ref $array_ptr1 eq 'ARRAY') { + push @result, @{$array_ptr1}; } - } - if (defined $array_ptr2 and ref $array_ptr2 eq 'ARRAY') { - foreach my $element (@$array_ptr2) { - push @result,$element; + if (defined $array_ptr2 and ref $array_ptr2 eq 'ARRAY') { + push @result, @{$array_ptr2}; } - } - return \@result; + return \@result; } sub removeduplicates {