I figured out a way to do what I wanted in my CGI.

The following is the code fragment that I use for my traceroute:

        open(TRACE, "/usr/sbin/traceroute $hostIP 2> /dev/null |");
        while (<TRACE>) {
            print "$_";

With this, I open the pipe to a traceroute, and then as each line is returned from the system, it’s printed to STDOUT (which, in the case of a CGI, is the webserver pipe to the browser client).