use strict; use warnings; use CGI; use CGI::Cookie; my $c = new CGI::Cookie( -name => 'session_id', -value => '23423', -domain => '.testdomain.com', -path => '/testfolder', -expires => '+30m', ); print header(-cookie=>$c); #--- Rest of Script