From 7aaca71a187dd8d91a45df4d6ede847c7925d796 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 29 Oct 2019 18:21:16 +0000 Subject: [PATCH] TT#69200 Use reverse in reversearray() instead of an ad-hoc implementation Change-Id: I805e1e7e06b57774275353d1457ed37e5c78a13e (cherry picked from commit fdc64d61ebb4dd0ad9eec127c9a1531b6faa88c9) --- lib/NGCP/BulkProcessor/Array.pm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/NGCP/BulkProcessor/Array.pm b/lib/NGCP/BulkProcessor/Array.pm index 6b00508..f6adda6 100644 --- a/lib/NGCP/BulkProcessor/Array.pm +++ b/lib/NGCP/BulkProcessor/Array.pm @@ -104,17 +104,14 @@ sub grouparray { } sub reversearray { + my ($array_ptr) = @_; - my ($array_ptr) = @_; - my @result = (); - if (defined $array_ptr and ref $array_ptr eq 'ARRAY') { - my $ubound = (scalar @$array_ptr) - 1; - for (my $i = $ubound; $i >= 0; $i -= 1) { - $result[$i] = $array_ptr->[$ubound - $i]; + my @result; + if (defined $array_ptr and ref $array_ptr eq 'ARRAY') { + @result = reverse @{$array_ptr}; } - } - return \@result; + return \@result; } sub contains {