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.

In reply to Re: variables from STDIN by Marshall
in thread variables from STDIN by stigmatt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.