diff options
| author | KjetilS <kjetilskotheim@gmail.com> | 2025-11-19 10:01:54 +0100 |
|---|---|---|
| committer | KjetilS <kjetilskotheim@gmail.com> | 2025-11-19 10:01:54 +0100 |
| commit | 09740d69a0c1831a7e0fab63123fc27abf260ebe (patch) | |
| tree | 42152e16d1ebc890dee69cdf952ebad0ad3c7c1d | |
| parent | 336bfe8561edddb6f52db35d5065d0f99310207d (diff) | |
| download | perlweeklychallenge-club-09740d69a0c1831a7e0fab63123fc27abf260ebe.tar.gz perlweeklychallenge-club-09740d69a0c1831a7e0fab63123fc27abf260ebe.tar.bz2 perlweeklychallenge-club-09740d69a0c1831a7e0fab63123fc27abf260ebe.zip | |
https://theweeklychallenge.org/blog/perl-weekly-challenge-348/
| -rw-r--r-- | challenge-348/kjetillll/perl/ch-1.pl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/challenge-348/kjetillll/perl/ch-1.pl b/challenge-348/kjetillll/perl/ch-1.pl index 389d2b6dd5..4be7a4ddd9 100644 --- a/challenge-348/kjetillll/perl/ch-1.pl +++ b/challenge-348/kjetillll/perl/ch-1.pl @@ -6,13 +6,13 @@ sub f_verbose { #same thing more verbose my($str, $count_vowels_left, $count_vowels_right) = (@_,0,0); if( $str =~ s/^(.)(.*)(.)$/$2/ ){ - my($left_char, $middle_string, $right_char) = ($1,$2,$3); - return f_verbose( $middle_string, - $count_vowels_left + ( $left_char =~ /[aeiou]/i ? 1 : 0 ), - $count_vowels_right + ( $right_char =~ /[aeiou]/i ? 1 : 0 ) ) + my($left_char, $middle_string, $right_char) = ($1,$2,$3); + return f_verbose( $middle_string, + $count_vowels_left + ( $left_char =~ /[aeiou]/i ? 1 : 0 ), + $count_vowels_right + ( $right_char =~ /[aeiou]/i ? 1 : 0 ) ) } else { - return $count_vowels_left > 0 && $count_vowels_left == $count_vowels_right + return $count_vowels_left > 0 && $count_vowels_left == $count_vowels_right } } |
