>>> The CGI example you mentioned is broken, but is also using a module (CGI.pm) that's been bad and wrong for so long that even Perl, with its eternal love for backwards compatibility has removed it from Perl Core.
The CGI example is straight copy/pasted from the official Perl guide, November 2018. https://www.perl.com/article/perl-and-cgi/