From 4edeb1d5a5cb7bef6f982eb2c2e44792d512e93e Mon Sep 17 00:00:00 2001 From: Anandha Krishnan S Date: Fri, 1 Dec 2023 22:24:24 +0530 Subject: [PATCH] String to vowelcase (#4806) Co-authored-by: Harsh Raj --- .../convert_string_to_vowelcase.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 program/program/convert-string-to-vowelcase/convert_string_to_vowelcase.pl diff --git a/program/program/convert-string-to-vowelcase/convert_string_to_vowelcase.pl b/program/program/convert-string-to-vowelcase/convert_string_to_vowelcase.pl new file mode 100644 index 000000000..319983d69 --- /dev/null +++ b/program/program/convert-string-to-vowelcase/convert_string_to_vowelcase.pl @@ -0,0 +1,15 @@ +print "Enter a string: "; +chomp(my $str = ); +my $result = ''; +$str = lc($str); +foreach my $char (split //, $str) +{ + if ($char =~ /[aeiou]/) + { + $result .= uc($char); + } + else + { + $result .= lc($char); + }} +print $result;