in reply to How keep the count...

> Should I create a hash with a sentenceIndex as key and the offset as a value, to then do my calculations?

No point. If you find that a sentence matches, just push the offset into an array, and the number of elements in the array ($#arr+1) is the number of sentences.

Replies are listed 'Best First'.
Re: Re: How keep the count...
by Anonymous Monk on Mar 03, 2004 at 16:36 UTC
    Thanks, I am going to try that, but in case I need to retrieve those sentences where the offset was 3, I need a hash eh?
      No, you don't need a hash for that either. You can have another array, which will contain the number of the sentence in which the offset was found.

      Or, if you absolutely insist on using hashes, you could, instead of two arrays, use an array of hashes, where each element of an array would be a hash, with two keys: offset and sentence_number.