in reply to Re^6: Not a HASH reference error
in thread Not a HASH reference error

That should have been:

die "$type doesn't exist in %{\$hashref} or isnt a hash ref" unless exists $hashref->{$type} && ref $hashref->{$type} eq 'HASH' +;

Dave