in reply to How keep the count...

Since you are only looking for two specific words, just use two variables,  $lazy and  $dog. If you might later want to know how many times any other word (say "jumps") shows up, then use a hash. . .

This smells strongly of homework btw. . .

- - arden.

Update: Sorry, I mis-read your original post. Since what you are looking for is the offset between the two words in every sentence, why not just use an array? I don't really recommend using a hash where the keys are sequencial numbers.

Replies are listed 'Best First'.
Re: Re: How keep the count...
by Grygonos (Chaplain) on Mar 03, 2004 at 16:27 UTC
    reeks of homework..provide samples of what you have tried so far...please explain the task you're trying to accomplish so we know we're not just doing your homework.

    Grygonos