>>I want to end up with output that is just httpd configuration directives without any Perl code left in it.
Does this work?
use strict;
use warnings;
my $configfile2parse = 'httpd.conf';
my $configfile2check = 'httpd.conf-stripped';
open FH, '<', $configfile2parse or die "cannot open httpd.conf";
my @content = <FH>;
close FH;
my $opener = qr{<Perl>};
my $closer = qr{</Perl>};
my @httpd_config_only = grep {!(/$opener/sg .. /$closer/sg)} @content;
open NH, '>>', $configfile2check or die "cannot open output file";
print NH $_ for @httpd_config_only;
close NH;
my $result = qx!httpd -S -f /work/$configfile2check!;
print $result . $/;
... tests ok here - but I hope I understood your original problem correctly. Another consideration might be separating out the perl code from httpd.conf using the Include directive within the config