in reply to Can't use string as a HASH ref problem
Your code doesn't apparently show the line that is triggering the problem stated (line 92), so it's kind of difficult to help with that.
Also, you didn't supply any example input, so we can't really test, but this line is probably wrong:
$hash_geno_group{$sample_geno_group}{"sample"}=$sample_nm;
Hash keys can only have one value, so you keep overwriting sample here. Use an array instead:
push @{ $hash_geno_group{$sample_geno_group}{sample} }, $sample_nm;
Also, the following are experimental warnings:
Use of my $_ is experimental at test_fontion4.pl line 68. keys on reference is experimental at test_fontion4.pl line 187.
If this is bound for production, fix them:
while (defined(my $_ = <GENOTYPED>))
to:
while (<GENOTYPED>)
For the keys on reference which you have no examples of in the code, you probably want something like:
keys %{ $hash_ref }
Use the three-arg form of open(), and use lexical file handles:
open my $genotyped_fh, '<', $list_geno or die "Cannot open $list_geno\ +n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can't use string as a HASH ref problem
by etricaen (Novice) on Apr 11, 2016 at 14:14 UTC | |
by stevieb (Canon) on Apr 11, 2016 at 15:59 UTC |