#!/usr/bin/perl use strict; use warnings; use CGI; my $q = CGI->new; my %data = ('url' => '/some/page.html'); my $cookie = $q->cookie('url' => \%data); print $cookie->as_string;