in reply to hashref and references

Your use of references looks fine to me. I think this line contains the actual error:
print DATAOUT "$_"+":"+"$ref->{$_}\t";
You're using Java syntax, not Perl. Try this instead:
print DATAOUT $_ . ":" . $ref->{$_} . "\t";
Unless of course you really do want to add up the strings, instead of concatenate them! :)

---
It's all fine and dandy until someone has to look at the code.