Japerlh wrote:
> How can we read files recursively?
> 
> Seems like filehandler is a global variable, no matter where it was defined.
> and put a openfile in a recursion function doesn't work.
> 
> Anyone can give me any hints?
> Thanks a lot.
> 
> 

In newer perl's you can store a filehandle directly to a lexical
variable. This should allow you to do what you need.

my $FILEHANDLE;
open $FILEHANDLE, '/tmp/file/to/open' or die "Can't open file: $!";

Obviously the variable will need to be scoped to the subroutine.

Though it seems a bit odd that you want to recursively read a filehandle.

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to