No such thing as a small change | |
PerlMonks |
Re^3: Element Count from Array to HoHby ivancho (Hermit) |
on May 26, 2005 at 07:56 UTC ( [id://460544]=note: print w/replies, xml ) | Need Help?? |
Yeah, my bad, I only meant {TTTT}{I2} - which is what my code does, I shouldn't have asked about {TTAT}{I1}.. My understanding is as follows. You get a pair "TTAT", "I2", and you say to yourself 'But this TTAT might actually be TTTT - so let's increase {TTTT}{I2} for good measure.. We'll increase {TTAT}{I2} too, when we get there...' If this is what you want to do, then my snippet should work fine.. The {map {(split)... line saves the unique 4 letter codes we have. Then for each line '$tid $item',gives us which of our 4 letter codes $item might be. For each of them, we increase their {$tid} field. I think the problem here is that your function tries to do everything at once.. Maybe you can split it in 2 pieces - first find all pairs of neighbours between the 4 letter codes, then go through your array and for every item with a tid, also increase this tid for it's neighbours.. hopefully this isn't just more mud...
In Section
Seekers of Perl Wisdom
|
|