I want to convert each letter in a sentence to a specific letter depending on whether it is a consonant or a vowel, where the vowels are AEIOU.
So, if I have a line
$string = 'Hello'
I would like to see
$string = 'CVCCV'
As a result.
I know I can use:
$string =~ s/A/V/ $string =~ s/B/C/ $string =~ s/C/C/
etc., to check and convert each letter separately, but, of course, there should be a more efficient way to do this.
source share