From: yun yun <[EMAIL PROTECTED]>
> I programed a recursive sub, but when I returned from
> one layer, the original file handler cannot be
> rescovered, how can I do it?
Either
sub foo {
local *FH;
open FH, "<$file";
while (<FH>) {
....
foo($otherfile);
}
}
or
use FileHandle;
sub foo {
my $FH;
open $FH, "<$file";
while (<$FH>) {
....
foo($otherfile);
}
}
I like the second option better, cause then the filehandle is just and
ordinary lexical variable that you can pass around easily.
Jenda
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]