in reply to assign File Handles to Scalar Variables
If you want to open a generic handle, I think you might want to look into IO::Tee. When you invoke it, you can specify an input handle and an output handle, thusly:open my $filehandle, '>', $filename or die "$!";
That will let you read or write to $generic_handleuse IO:Tee; open my $input_handle, $in_filename or die "$!"; open my $output_handle, '>', $out_filename or die "$!"; $generic_handle = IO::Tee->new($input_handle, $output_handle);
Update: Added code to clarify you have to open $input_handle and $output_handle before teeing them.
|
|---|