#!/usr/bin/perl -w use strict; use WWW::Mechanize; my $cookie_file = "/tmp/cookies"; my $agent = WWW::Mechanize->new(); if (! -s $cookie_file){ $agent->get("http://okopnik.com/PHP/other/cookies.php"); # Save the cookie from this session $agent->cookie_jar->save($cookie_file); } else { $agent->cookie_jar->load($cookie_file); $agent->get("http://okopnik.com/PHP/other/cookies.php"); } print $agent->content;