Ken Williams
Tue, 18 Jan 2005 04:39:22 -0800
Apologies first of all for my original useless response. Here's how I would do it -- and it works.
while (<>) { /Contig([0-9]+)/i and $hash=$1 and eval "my \%$hash"; /CR05-C1-102|CR05-C1-103/i and eval "\$$hash\{\$&\} += 1"; }
A bit eval-y for my tastes. I'd translate that to:
while (<>) {
($n) = /Contig([0-9]+)/i;
/CR05-C1-102|CR05-C1-103/i and $data{$n}{$&}++;
}and use a real two-level hash.
-Ken