use Capture::Tiny qw/ capture /; my($stdout, $stderr, $exit) = capture { system '.../curl', ...',"\r\n\r\n..."; };;