open(my $fh, '>', '/tmp/data.txt') or die("Can't create file /tmp/data.txt: $!\n"); print $fh $res->content; close($fh);