If CGI.pm is deprecated, then what is better solution that is as simple as CGI.pm?
The idea is not to get rid of CGI.pm per se, it's to get rid of multi-entrypoint (per-file) CGI-based architectures, instead having (1) all routes in more or less once place, making it much harder to leave sensitive endpoint not protected by a requirement to authorize and (2) template-based page rendering as opposed to print "<html>", ... mixed with domain-specific logic, which some CGI.pm-based scripts are famous for.
So if you want to have a single script to be called by your web-server using the CGI protocol, you can still use CGI.pm, but please also consider templates. See also: XY problem. What are you trying to build using this CGI script?