in reply to Re: capturing stdout of pipe
in thread capturing stdout of pipe

However, in the specific case of curl, my preferred answer is: don't shell out in the first place but use a module instead.

Yes, definitely!

It's an FAQ! How can I open a pipe both to and from a command?

That FAQ answer says to use IPC::Open2/3, but for my personal tastes those are a little too low-level. If one really had to do this (of which this isn't a case), I would try IPC::Run first.