Recently I built a CGI script using Perl for my own pleasure. It was quite easy indeed, just a case of importing Template Toolkit, GD and CGI.pm then printing the result to stdout. Since I'm only using CGI.pm to send the HTTP header it isn't really necessary.
The result is here: https://www.thran.uk/cgi-win/fleg.pl
It is a flag generator affectionately titled flegger.