In fact I found the problem. Clearing the hash with $user = (); causes all of the values to be undefined. If I use the doClearUser sub then they are all blank and the update proceeds as it ought.
Too many hours at the keyboard and not enough coffee!
jdtoronto