Hello, David.

Looks to me like you want an array of arrays of hashes, or perhaps a
hash of arrays of hashes.  Something along these lines...

my ($counts);

> # compute data from corresponding files
> foreach $filename (@filelist) {  
>     open(INPUT,"$filename")  || 
>       die "Sorry, couldn't open INPUT file for reading:
> $!"; # .txt files going in 
>     foreach $line (<INPUT>) { # checks each line in
> each file of the file array.
>       ($gene,@remainder) = split(/\t/,$line);
> 
> ## THIS IS WHERE I'M STUCK

for my $i (0 .. $#remainder) {
    # Increment the counter indexed by $gene, $i, $remainder[$i]
    $counts->{$gene}->[$i]->{$remainder[$i]}++;
}

>     }
> }

# Iterate over genes.
for my $gene (sort (keys (%$counts))) {
    my ($gcounts) = ($counts->{$gene});
    print $gene;
    # Iterate over columns.
    for my $i (0 .. $#$gcounts) {
        my ($ccounts) = ($gcounts->[$i]);
        my ($outcode) = ('NC');
        # Iterate over column values and their counts.
        while (my ($code, $count) = each (%$ccounts)) {
            if ($count >= 7) {
                $outcode = $code;
                last;
            }
        }
        print "\t$outcode";
    }
    print "\n";
}

Hope this helps.

-- 
John Tobey <[EMAIL PROTECTED]>
\____^-^
/\  /\
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to