A tied hash might be the ticket, which could return some default in the FETCH sub (or the value with a key of 'default' or somesuch or you could pass in the default key or value during the tie) if the key doesn't exist in the underlying real hash. See perltie. (Sorry for the lack of example, you can Super Search around here for examples, though).