Anonymous Monk,
Your insistence on using a hash strengthens my feeling that this is a homework problem. While I do not mind homework problems nearly as much as other monks, if this is homework you should state:
- That it is homework
- What the specific requirements are
- What you have tried so far
- What you "think" may work but do not know how to code
Now to answer your questions, there is no need to use a hash. you could change:
# push @offsets, $_ - $first + 1;
# to
push @offesets, [ $line , $_ - $first + 1 ];
# and
# print "$_\n" for @offsets;
# to
print "$_->[0] : $_->[1]\n" for @offsets;
Cheers - L~R | [reply] [d/l] |
This is not a "homework", is a project in language generation. There are not specific requirements, we have to find ways to generate natural phrases, idioms, expressions etc. This was one of the ideas: train a large file and find those sentences where the co-occurrence of n words occur in n specific gap. Find the most frequent offset and retrieve the sentence to check in which context they appear. The insistence of hashes is dumb, I just wanted to prove my point... somebody that validate my idea that hash was the only solution..:-(
Sorry that I did not provide more information before, I only wanted to keep it simple. Thanks
| [reply] |