in reply to Doubt on hash keys

UPDATE: I took the "How" at face value instead of interpreting it as a 'Why'. Please disregard this answer.

The simple answer would be: print "bye";. The more serious answer: How do you want to identify the "bye"?. Do you want to get the key for which the value is a pointer to a hash with the key 'later'?

my $result; foreach my $v (keys %hash) { if (exists $hash{$v}{'later'}) { $result= $v; }

Or do you want the second value in the hash? That is not possible. There is no order in a hash, so there is no *second* value

Or do you want to print all hash keys? But that would also print 'hi':

print join(' ',keys %hash);

Or do you really just want to print the fixed string "bye" no matter what? See my first answer.