Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: create unique array

by virtualsue (Vicar)
on Jan 27, 2007 at 09:39 UTC ( #596852=note: print w/ replies, xml ) Need Help??

in reply to create unique array

Your task can be more easily handled by using a hash rather than an array. When you say that the data is in an tab-separated array, do you mean that you have a file which consists of tab-separated lines containing the data? Since you only want to keep one entry for each ID, then a hash containing a reference to an array holding the organism and number values will be a good way to go. Do you have any code we can help you with? Check out the Tutorials section if you need to read up on the data types.

Update: A skeleton which will read in your data line by line...

#!/usr/bin/perl use warnings; use strict; my %proteins; while (my $line = <DATA>) { chomp $line; my ($pro, $org, $value) = split '\s+, $line; # \s+ : one or more wh +itespace chars } __DATA__ protein1 organism1 0.843534 protein2 organism2 2.45 protein3 organism3 9.5322 protein4 organism4 0.3475474 protein1 organism6 9.4534 protein2 organism7 0.43534 protein2 organism8 1.2434 protein3 organism9 0.000003 protein3 orgnanism10 1.23325

Comment on Re: create unique array
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-11-28 16:47 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (743 votes), past polls