in reply to Can I return a filehandle from Curl?

As the AM pointed out, $fileb is a filehandle ... one that's only opened for writing but still, a filehandle. Maybe you need the filehandle to be open for reading and writing? In that case, just do so. I always find it useful to take the code in the docs and modify them to meet my conditions *before* I try to jam the new code into a legacy system:

... my $response_body; # # open the file for reading and writing # open( my $fileb, "+>", \$response_body ); $curl->setopt( CURLOPT_WRITEDATA, $fileb ); ... # rewind the file handle seek $fileb, 0, 0; while( <$fileb> ) { print $_; }

-derby