UPDATE 01/03/04 - Just got home from Disneyland and added some code for whoever is still tuned into this thread.
So far I have:
#! usr/bin/perl #midterm part 1 use warnings; open (TEXTFILE, 'text.txt') or die ("Cannot open file : $!"); $big_string = <TEXTFILE>; $big_string = lc ($big_string); $big_string =~ s/\(|\)/ /g; @words = split (/[,.\s+]/, $big_string); foreach (@words){ push @gt_three_char_words, $_ if /[a-zA-Z]{4,}|[a-zA-Z]{3,}'/; } foreach (@gt_three_char_words) { $hash{$_}++; } foreach (%hash) { print $_, "\n"; }
As you can see I haven't implemented the slurp yet, but I did get nnn'n words to work, and I now have a hash with word keys and count values. I went for the foreach instead of the map for now. I'll play with map (and grep) later. It may be all downhill from here, so many thanks to everyone who helped...I learned a ton!
Quoted from the original post:
The problem at hand is to write a script which will read a text file, and list the most common words found, >4 characters, and print out the top ten, each with their number of occurences, sorted by frequency.

In reply to tutelage needed by ctp

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.