SPUG: Introducing me + dumb newbie question

Michael Herrewig mherrewig at hotmail.com
Thu Sep 23 13:13:38 CDT 1999


Hi,

First, I'd like to introduce myself.  My name is Mike Herrewig.  I've just 
recently moved to Everett from Baraboo, WI.  I've been using information 
systems since 1994 when I joined the Army.  Since, I have had experience 
with almost everything.  If it has a monitor and keyboard I've probably used 
it:)

A few weeks ago I began my rigorous perl self-education with "Learning Perl" 
by the wonderful people at ORA.  I have no previous programming experience 
besides a little BASIC(more specifically Qbasic), with a dash of Pascal and 
some bash shell thrown in for flavor.

Anyway, here's my question pertaining to Chapter 5, Hashes.  Exercise 2 at 
the end of the chapter challenged me to the point of total confusion.  I 
tried for a couple of hours to figure it out myself before giving up and 
looking at the answer in the back.  After seeing the answer I was even more 
confused.  For those who don't have the book I'll include the exercise and 
code below:

2. Write a program that reads a series of words with one word per line until 
end-of-file, then prints a summary of how many times each word was seen.

#!/usr/bin/perl -w
#typos are mine :)
print "Please enter a few words, one word per line (^D to end)\n";
chomp(@words = <STDIN>);
foreach $word (@words) {
   $count{$word}++;
}
foreach $word (keys %count) {
   print "$word was seen $count{$word} times.\n";
}

If anybody can answer 1 or more of the following questions, it would be 
wonderfully appreciated to the point where I may consider sending money:)

1. at which point is the %count actually created and what values are being 
injected(I'm assuming numbers)?
2. does %count only contain keys? the book mentioned nothing of this 
functionality.
3. is there a perl IDE available to set breaks and step through the code and 
view variable info intermittantly like Qbasic (lame i know)?
4. do I read the perldocs with man or perldoc?
5. anybody have a jr. SA job available for a hard-working, fast learning, 
enthusiastic person?

If you've made it this far, thank you.  I look forward to meeting some of 
you at the next meeting (if I'm still invited after sending this blatantly 
self-serving message :)  I bow to the perl gurus.
-

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list