in reply to Tying hashes with undef keys

Read perltie#Tying hashes

I have not spent much time working with tied variables. However, it appears that the FIRSTKEY and NEXTKEY functions are supposed to return a key, value pair. The end of the list would therefore be denoted by (). Although your undef appears to work as well.

Note that normally hash keys are as a rule defined strings. However, I would guess that you might be able to return an undefined key using the following
sub FIRSTKEY { return (undef, 'foobar'); }
- Miller