how to pass a file handle to child process in perl.it can't work like this:?

Chaofei

New member
i want to pass a file handle to child process.like this:
system("perl child.pl $filehandle");
but it doesn't work.the value passed to child is only a string.i can't use it to read file.


if i pass it like this:
$LB::var;
i can't use it in child process either.


like this:
%ENV{$var}=$filehanlde;
it doesn't work.it is also a string value can't be used as a file handle.


or like this:
open (TEXT,"file");
system("perl child.pl",*TEXT);
in child i use the parameter like this:
local *TEXT=shift;
while(<TEXT>){
print;
}
it doesn't work either.

maybe i can't pass a variable in command line like
system("perl child.pl" ,parameter);
maybe i can't create a child process like this.

how could i pass a file handle to child process when using system to create child process.
should i create child process in other way. then i can pass the file handle.
 
Back
Top