Thanks for this. :)
It works with chorobas snippet and yours.
I tried the escapeHTML function but Perl said that it couldn't find this one. According to the version 3.65 manual escapeHTML is being executed automatically.
My webserver has CGI.pm version 3.42 installed. So my guess is that escapeHTML is a feature that was introduced in a later version.