#!/usr/local/bin/perl -Tw

BEGIN {
   use CGI qw(:standard); # for cookie code
   $| = 1; # fflush after every print
}

{
   my $input = new CGI;

#...

   # -- Cookie with multiple values
     #++
     # N.B.: It is safer to send $user and $art in a cookie than to send
     #   the log file name.  The log file name could be faked and not
     #   easily checked.  The article and session numbers could be faked
     #   but must still be within the valid range and cannot be used to
     #   overwrite existing logs.  Etc.
     #--
   # -- Make cookie
   $mycookie = $input->cookie(-name  => 'values',
                    # no expires value so cookie will stay until Mozilla exits
                    # or expiry is forced
                              -value   => {'user'=> $user,
                                           'etc' => $etc});

   # -- Write cookie and redirect at the same time
   print $input->header(-type     => 'Multipart/mixed',
                        -cookie   => $mycookie,
                        -Location => $redirect_to);
}
