use strict; use warnings; my $configfile2parse = 'httpd.conf'; my $configfile2check = 'httpd.conf-stripped'; open FH, '<', $configfile2parse or die "cannot open httpd.conf"; my @content = ; close FH; my $opener = qr{}; my $closer = qr{}; 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 . $/;