Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Added String Consonantcase perl (#4760)
Browse files Browse the repository at this point in the history
Co-authored-by: Adesh Bhosale <adesh@Adeshs-MacBook-Air.local>
Co-authored-by: Harsh Raj <harshraj8843@gmail.com>
  • Loading branch information
3 people authored Dec 1, 2023
1 parent 7b8555e commit 5379c80
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sub consonantcase {
my ($input) = @_;
my %vowels = ('a' => 1, 'e' => 1, 'i' => 1, 'o' => 1, 'u' => 1);
my @chars = split('', $input);
for my $char (@chars) {
if (exists $vowels{lc($char)}) {
print lc($char);
} else {
print uc($char);
}
}
print "\n";
}

# Test with input "hello world"
consonantcase("hello world");

0 comments on commit 5379c80

Please sign in to comment.