I've done some reading and it sounds like it is possible to have numeric hash keys and perl is supposed to figure out when numbers should act as numbers and when they should act as strings. However, I am getting an error message that indicates to me that it thinks my numbers are strings. Any advice appreciated. Thanks
use strict; use warnings; use Data::Dumper; ############################ my $inGNPS="MsRtLib_all.tab"; open(IN,$inGNPS); my %HoPMAnnot; my %HoPMrtAnnot; while(my $line=<IN>){ chomp $line; my ($ParMass,$RT,$annot)=split(/\t/,$line); $HoPMAnnot{$ParMass}=$annot; $HoPMrtAnnot{$ParMass}{$RT}=$annot; } close(IN); print Dumper (%HoPMAnnot); ###### my $inATdat="consensus_features_extracted.csv"; open(IN,$inATdat); while(my $line=<IN>){ chomp $line; next if($line =~/^,/); # header starts with comma my ($feat_numb,$mz_min,$mz_max,$rt_min,$rt_max,$quality,$inten +sity)=split(/,/,$line); foreach my $PM (keys %HoPMAnnot){ if ($PM <=$mz_max && $PM >=$mz_min){ print join("\t",$line,$HoPMAnnot{$PM})."\n"; } } } close(IN);
data dumper output
$VAR1 = '272.043'; $VAR2 = 'N/A'; $VAR3 = '272.188'; $VAR4 = 'N/A'; $VAR5 = '838.844'; $VAR6 = 'Sodium_Formate'; $VAR7 = '601.393'; $VAR8 = 'N/A';
error
Argument "parent mass" isn't numeric in int at checkTheoFeat4GNPSannot.pl line 25, <IN> line 1034.
In reply to numeric hash keys by AWallBuilder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |