#!/usr/bin/perl use strict; use warnings; local $/; # slurp my $content = ; my $error; # Preprocess while (local ($_) = $content =~ /^#include\s(.*?)$/m) { if (/; $content =~ s/#include\s$_/$include/; next; } } continue { if ($content =~ s/#include\s$_//) { warn "Unhandled include $_\n"; $error++; } } die "$error errors encountered" if $error; __DATA__ #include "stdafx.h" #include #include "AlyLee.h" #include "Common.h"