Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Element Count from Array to HoH

by ivancho (Hermit)
on May 26, 2005 at 07:56 UTC ( [id://460544]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Element Count from Array to HoH
in thread Element Count from Array to HoH

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',
grep {hd($item,$_) <= $d} keys %$trans_map_ref
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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://460544]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (1)
As of 2024-04-24 16:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found