Two recommendations -- neither of which goes to your current issue (answered well, above), but which may be important in some other context:

IMO (Caveat: my O is neither definitive nor authoritative), you rely too much on the default var, $_. Doing so, in the face of possible future needs for tweaking, extension, modification, or refactoring of your code can
  a) create a script-version that inadvertently replaces the content of $_ with something other than its current content... and
  b) make - for yourself or some future programmer - a head-scratcher about what's supposed to be in $_, once you're reading some lines down.

Changing your code (and code-writing practices) to use explicitly named vars for values you're passing around, hither-and-thither, is relatively low overhead -- while writing and when executing. For example, one could do this (your line numbers, my comments):

056: my (@words, $char, $vowel); 057: while (<$IN>) { 058: @words = split /[\W]/, ; 059: for my $word(@words) { ## explicit va +riable declared... 060: print $OUT (encode ('UTF-8', $word)) . "\n"; ## and put +to further use... 061: my $count = 0; 061a-061z: ## hypothetical insert, tweak, + extension, etc 062: my $end = length($word); ## Ahah, easy +to verify that ## we're gettin +g word length 063: for (my $i = 0; $i < $end; $i++) { 064: $char = substr($word, $i, 1); ## and again.. +..

I also recommend that you consider advice seen often here; that you eschew using the &foo... form of sub call which precedes the sub name with an ampersand... unless you know * EXACTLY * why you need the ampersand. Summarizing that advice: "Don't, because using the ampersand when not needed can help you create bugs that are very hard to find... and because it probably doesn't do what you think it does."

Here's some additional reading:

hth

In reply to Re: Comparing Unicode Greek Characters/Code Points by ww
in thread Comparing Unicode Greek Characters/Code Points by plwtoday

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.