aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-026/lubos-kolouch/perl5/ch-2.pl7
1 files changed, 5 insertions, 2 deletions
diff --git a/challenge-026/lubos-kolouch/perl5/ch-2.pl b/challenge-026/lubos-kolouch/perl5/ch-2.pl
index 96b5be4b04..2575514bae 100644
--- a/challenge-026/lubos-kolouch/perl5/ch-2.pl
+++ b/challenge-026/lubos-kolouch/perl5/ch-2.pl
@@ -30,8 +30,11 @@ sub get_mean {
my ( $sin_sum, $cos_sum );
- $sin_sum += sin( deg2rad($_) ) for @angles;
- $cos_sum += cos( deg2rad($_) ) for @angles;
+ for (@angles) {
+ $sin_sum += sin( deg2rad($_) );
+ $cos_sum += cos( deg2rad($_) );
+ }
+
return rad2deg( atan2( $sin_sum, $cos_sum ) );
}