Say I have a table which has values in two columns :- Column1 = $var1 and Column2 = $var2 (note they are both chromosome coordinates so they are bound to be repeated in different columns sometimes).Now I want to store them in a hash such that there is only one instance of $val1 and $val2 in both the keys and values of that hash. How can I achieve it. This is what I have tried so far but it does not works :- Any help would be appreciated
use strict; use warnings; while(<>){ my @val = split/\t/; if (exists $hash_chr{$val[$#val]}){ next; } else{ $hash_chr{$val[0]}=$value[$#val]; } }
In reply to hash with both values and keys unique to each other by perlkhan77
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |