On Jan 21, 2008 10:27 AM, Kevin Viel <[EMAIL PROTECTED]> wrote:

> >     $data{$snp}{$genotype}++
>
> Is the semicolon unnecessary for this line?

It's not the line that matters, so much as what's going on. The
semicolon is used after most statements to indicate the end of the
statement; but the compiler can automatically recognize the end of the
statement when it is at the end of a block, for example.

> So, if I understand correctly  $data{$snp} is a value in a hash.  That value
> is a scalar that happens, in this case, to be a reference to an anonymous
> hash?  The key of this anonymous hash is $genotype?

That sounds about right.

> My goal is to print all of the SNP (keys of outer) that have more than two
> alleles (keys of the second anonymous hash).  How can I achieve this?
>
> for my $SNP_keys ( sort { $a cmp $b ) keys %outer ){
>
>   my $num_alleles = keys _______ ;

I think what goes in the blank is %$inner, after this:

    my $inner = $outer{$SNP_keys};

That is, I think that $inner holds a reference to the inner hash you
want to work with at that point in your program.

You can learn more about how to dereference a reference in the
perlreftut manpage.

    http://perldoc.perl.org/perlreftut.html

Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to