The CGI.pm code in many places iterates over hash keys without sorting them. Newer perl versions deliberately give a nondeterministic ordering of hash keys. This means that CGI.pm has nondeterministic observable behaviour. The fix is to use sort keys instead of keys.