aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wilson <steven1170@zoho.eu>2023-07-31 21:52:59 +0100
committerSteven Wilson <steven1170@zoho.eu>2023-07-31 21:52:59 +0100
commitbc832b19dd7f9507b7c3b787959b8368c18fe7d9 (patch)
treec5087ab8d7127468c7002468e7777b077ce66e11
parentc3f8b7f1b9db49c31cae54702aaefa86ddbd11f5 (diff)
downloadperlweeklychallenge-club-bc832b19dd7f9507b7c3b787959b8368c18fe7d9.tar.gz
perlweeklychallenge-club-bc832b19dd7f9507b7c3b787959b8368c18fe7d9.tar.bz2
perlweeklychallenge-club-bc832b19dd7f9507b7c3b787959b8368c18fe7d9.zip
small changes
-rw-r--r--challenge-228/steven-wilson/perl/ch-02.pl5
1 files changed, 2 insertions, 3 deletions
diff --git a/challenge-228/steven-wilson/perl/ch-02.pl b/challenge-228/steven-wilson/perl/ch-02.pl
index 2af5a79c64..17b0e0689e 100644
--- a/challenge-228/steven-wilson/perl/ch-02.pl
+++ b/challenge-228/steven-wilson/perl/ch-02.pl
@@ -12,16 +12,15 @@ done_testing();
sub empty_array {
my @elements = @_;
my $ops = 0;
- while ( @elements ) {
+ while (@elements) {
if ( min(@elements) == $elements[0] ) {
shift @elements;
- $ops++;
}
else {
my $element = shift @elements;
push @elements, $element;
- $ops++;
}
+ $ops++;
}
return $ops;
}