in reply to works as a perl script, but not as cgi

Did you try running your cgi script from the command line?

Grab a shell and head to your webserver, the script may give you extra warnings etc to STDERROR (which, as ikegami points out appear in the logs)

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;