in reply to Re^2: Includes within includes
in thread Includes within includes

Are these rules files generated by a program, or have they been hand coded? If the latter, you probably want to check for single quotes around the filename too, rather than just double quotes.

You've got my $count twice (as strict will warn you.) The value of $count isn't going to make it out of the if statement, so your $count == 0 test will always succeed.

In your

$main_file_line =~ /^(\s+)?include\s+"(.*)"$/
the (\s+)? is obfusciated; \s* is much clearer and efficient.

Are you sure you don't have any circular dependencies in your include statements? You aren't testing for them. If there is one... well, endless loops take a long time to finish. Also, how do you want to handle the case where there are overlapping dependencies? E.g, A includes B and C; B and C each include D. Do you really want D and its dependencies to be searched twice?

throop