perlkhan77 has asked for the wisdom of the Perl Monks concerning the following question:

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]; } }