I need to parse a file that can include other files (which can include other files, etc). I think the easiest way to handle this would be recursion but I'm not sure how well perl handles opening a filehandle with the same reference. To clarify:
sub get_hosts { my $file = shift; open (HOSTS, <$file) or die("I can't open $file"); while (<HOSTS>) { if ( /^include (.*)$/ ) get_hosts($1); &parse_line; } close HOSTS; }
Can perl handle this gracefully? If not, what are my options? I can try it and see but thought I'd ask.
-solIn reply to recursive file open by solitaryrpr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |