in reply to variables from STDIN

I was just trying to "hard code" this C->consonant and V->vowel for "just" English (probably one of the most difficult languages) and I wound up in trouble. For example in English sometimes Y is a vowel and sometimes a consonant (or so I think...grammar was never my strong suit).
oxforddictionaries.com/words/is-the-letter-y-a-vowel-or-a-consonant

I think that the "rules" are more complex than you have specified.
This code is simple, but I think it illustrates this "y" difficulty.

#!/usr/bin/perl -w use strict; my @array = ("BOB", "Sheila", "Very", "by", "berry", "beyond"); foreach my $word (@array) { my $original = $word; $word = uc $word; $word =~ s/V/C/g; $word =~ s/[AEIOUY]/V/g; $word =~ s/[^V]/C/g; printf "%-10s %s\n", $original, $word; } __END__ BOB CVC Sheila CCVVCV Very CVCV by CV berry CVCCV beyond CVVVCC #No!!!
I guess at the end of the day, I don't understand the complete problem.
But if am to match some input words against some CVC pattern, I need to be able to translate the words into that pattern and I don't know how to do that according to the grammar rules that have been specified.

Replies are listed 'Best First'.
Re^2: variables from STDIN
by tangent (Parson) on Feb 22, 2012 at 17:30 UTC
    A vowel is a voice sound (from the Latin vox - a voice) characterized by the absence of friction-causing obstruction in the vocal tract, allowing the breath stream free passage. In written text it is a character that represents that sound. So you are right about the "y". Consonant too refers to a sound (from the Latin sonãre - to sound).