How to create a matrix format in perl

Posted by shaq on Stack Overflow See other posts from Stack Overflow or by shaq
Published on 2012-09-02T11:16:36Z Indexed on 2012/09/02 15:38 UTC
Read the original article Hit count: 146

Filed under:

I have an array of array in which each array is like:

clusterA gene1 1
clusterA gene2 0
clusterB gene1 1
clusterB gene2 0

I want to produce a file like:

name       gene1    gene2 
clusterA    1         0
clusterB    1         0

Current attempt:

if (condition) {

    @array = ($cluster, $genes, "1");
}
elsif (not condition) {

    @array = ($cluster, $genes, "0");
}
push @AoA, [ @array ];  

@A0A is my array of array.

© Stack Overflow or respective owner

Related posts about perl