On Jan 17, 2005, at 6:06 PM, John Delacour wrote:


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



Reply via email to