$data->{foo} = ""; if ( exists $data->{foo} ) { print $data->{foo}{bar}; # 'Can't use string ("") as a HASH ref...' }