while(<>){ ($coords,$entry)=split; ($coord1,$coord2)=split 'v',$coords; $M{$coord1}{$coord2}=$entry; } print $M{AA}{CH},"\n"; #just to test