in reply to Clean up httpd.conf virtual host mess with perl

As posted above, I don't see much wrong with your code. One thing I would say though, you do have duplication of the opening and closing virtual host tags. You could fix this by changing your three print lines to look like this...
print OUT "<VirtualHost *:80>"; print OUT $vhost; print OUT "</VirtualHost>"; -> print OUT "$start$vhost$finish";
My personal take on the whole thing would be as follows. I don't know if it could be regarded as better though.
open(FH, '< vhosts.conf'); my $content = do {local $/; <FH> }; while ($content =~ m|(<VirtualHost \*:80>.*?</VirtualHost>)|sg) { my $vhost = $1; my ($name) = $vhost =~ m/ServerName\s(\S+)/; open(OUT, "> $name.conf") or die "Can't open outfile $name: $!\n"; print OUT $vhost; close(OUT); }