From 2b13bb6724f70eb1fe9a2b88378c1b9ad458fae0 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 8 Nov 2019 20:15:04 +0100 Subject: [PATCH] TT#69200 Switch from C-style for loops to range ones Change-Id: Ia65ed1ee29dd57339749123d99835262884db689 --- lib/NGCP/BulkProcessor/Array.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/NGCP/BulkProcessor/Array.pm b/lib/NGCP/BulkProcessor/Array.pm index f7e86d1..6246987 100644 --- a/lib/NGCP/BulkProcessor/Array.pm +++ b/lib/NGCP/BulkProcessor/Array.pm @@ -144,13 +144,13 @@ sub arrayeq { return 0 if $ubound1 != $ubound2; if ($case_insensitive) { - for (my $i = 0; $i <= $ubound1; $i += 1) { + foreach my $i (0 .. $ubound1) { if (lc($array_ptr1->[$i]) ne lc($array_ptr2->[$i])) { return 0; } } } else { - for (my $i = 0; $i <= $ubound1; $i += 1) { + foreach my $i (0 .. $ubound1) { if ($array_ptr1->[$i] ne $array_ptr2->[$i]) { return 0; } @@ -169,13 +169,13 @@ sub seteq { my $ubound2 = _array_last($array_ptr2) // -1; # every element of array1 must be existent in array2 ... - for (my $i = 0; $i <= $ubound1; $i += 1) { + foreach my $i (0 .. $ubound1) { if (not contains($array_ptr1->[$i],$array_ptr2,$case_insensitive)) { return 0; } } # ... and every element of array2 must be existent in array1 - for (my $i = 0; $i <= $ubound2; $i += 1) { + foreach my $i (0 .. $ubound2) { if (not contains($array_ptr2->[$i],$array_ptr1,$case_insensitive)) { return 0; } @@ -192,7 +192,7 @@ sub setcontains { my $ubound1 = _array_last($array_ptr1) // -1; # every element of array1 must be existent in array2: - for (my $i = 0; $i <= $ubound1; $i += 1) { + foreach my $i (0 .. $ubound1) { if (not contains($array_ptr1->[$i],$array_ptr2,$case_insensitive)) { return 0; } @@ -213,7 +213,7 @@ sub filter { my @result = (); # every element of array1 must be existent in array2 ... - for (my $i = 0; $i <= $ubound1; $i += 1) { + foreach my $i (0 .. $ubound1) { if (contains($array_ptr1->[$i],$array_ptr2,$case_insensitive)) { push @result,$array_ptr1->[$i]; }