oops... I think you have gone astray somewhere there ...

firstly just declare the hash

my (%count);
Now where you have $para++;$sen++;$vow++; replace them with$count{'para'}++; etc....

Finally in your print statement you need both the key (para,sen,vow) and the values (2,5 ,whatever )so replace print "$value"; with print "$value : $count{$value};
You should probably replace the $value with $key because it is misleading (it actually is the key and not/ the value.

What you were doing was creating 3 new variables which had nothing to do with your script.

I just had a look at the rest of you script and it's a bit of a mess :-) I dont have time now but here's how I would count the sentences and vowels

undef $/; while(<>){ my @chars=split(//,$_); foreach my $char (@chars) { $count{'vow'}++ if(/[aeiou]/); $count{'sen'}++ if(/\./); }
Diarmuid

In reply to Re: New perl student... feeling stupid by diarmuid
in thread New perl student... feeling stupid by Anonymous Monk

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.