in reply to Hash Ref Error

The error message is telling you that $my_data_ref is not declared even though it clearly is. I suspect that there is an error earlier in the program, perhaps a missing quote or semicolon. It is also possible that $my_data_ref is used somewhere else (where it is out of scope). The line number in the error message is important. Are you sure that it refers to line that you posted?
Bill