my $cookies = new HTTP::Cookies; $cookies->set_cookie(0,'foo','foog','/','.blah.com','80',0,0,1000,1,{}); $cookies->set_cookie(0,'moo','1025','/','.blah.com','80',0,0,1000,1,{}); my $text = $cookies->as_string; # do anything to $text, and come back later pipe Read, Write; print Write "#LWP-Cookies-1.0\n" . $text; close Write; my $cook = new HTTP::Cookies; $cook->load( '<& ' . fileno(*Read) ); # $cook is now the same as $cookies above and we can use it as if it was print $cook->as_string;