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

Re^3: finding matches in the same array

by sh1tn (Priest)
on Apr 13, 2005 at 19:42 UTC ( [id://447567]=note: print w/replies, xml ) Need Help??


in reply to Re^2: finding matches in the same array
in thread finding matches in the same array

You are right, it's utterly different algorithm.
The correct one is as follows:
@seq = ('acgt','actg','cggt','cggt', 'actg', 'actg'); @num = ('1234','2345','3244','3455', '5230', '100000' ); for( 0..$#seq ){ $struct{$seq[$_]}->[0] += $num[$_] and $struct{$seq[$_]}->[1]++ } for( keys %struct ){ print "$_\t", $struct{$_}->[0] / $struct{$_}->[1], $/ } __END__ STDOUT: acgt 1234 cggt 3349.5 actg 35858.3333333333


Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-19 02:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found