in reply to Includes within includes
Looking at your code, one big problem stands out with regard to recursion. "FH1" needs to be localized in some way (as you'll see in merlyn's article). I think most people today would do this by putting the file handle in a scaler variable. Just put a
at the top of your srch_include() sub, and replace "FH1" with "$fh1". That should take care of the problem. There are other ways to take care of this. You can localize a file handle with a simple "local *FH1;", but it's an old way of doing things. You can also accomplish what you need just by closing the file handle so that it can be reused. You can use "IO::File" as mentioned in merlyn's article. For me "my $fh1;" is the best of the choices.my $fh1;
|
|---|