#!/usr/bin/perl -w use strict; print "Content-type: text/plain\n\n"; eval { require 'foo.pl'; } if ($@) { print "ERROR:\n\n$@"; } else { print "OUTPUT:\n\n"; print `perl foo.pl`; # that's `, not ' }