Update ReferenceData.pm

Adding error checking; moving dbi handle;