setprefs.pl, no-database version

#!D:\Perl\bin\perl.exe 
use CGI qw/:standard/; 
use CGI::Cookie;
# The first thing we do is grab the preferences from the 
# submitted form and store them in an array.
for ($i=0; $i<11; $i++) { 
    $prefs[$i] = param($i) || "0"; 
}
$username = param("firstname");
$username =~ s/~:~/~;~/g;
# We create the prefs string out of our form results. 
$prefstring = $username. "~:~". join ("~:~", @prefs); 
# We create the cookie, with a name, preferences string, 
# and expires time of 10 years.
$tkcookie = new CGI::Cookie(-name=>'moviereviewprefs',
    -value=>$prefstring,-expires=>'+10y');
# Now, we use the Set-Cookie HTTP heading to actually set 
# the cookie. This is what the  M-Business Sync Server needs 
# to set the value of a cookie.
print "Content-type: text/html\n"; 
print "Set-Cookie: $tkcookie\n";
# Nobody should ever see this form, becuase we're sending 
# this with submitnoresponse. But I keep it around for 
# debugging purposes. 
#
print <<END_of_Response;
<HTML> 
    <HEAD> 
    <META name="HandheldFriendly" content="true"> 
    <TITLE>Cookie has been set</TITLE> 
    </HEAD> 
    <BODY> 
    Thanks for your submission! 
    <p> 
    Please go back to the <a href="/cgi-bin/movies3/frontpage.pl">
        Front Page to read more movie reviews. 
    <p>
END_of_Response
# And now, the important legal message... 
# 
# Copyright (c) 2007, iAnywhere Solutions, Inc., 
# all rights reserved. 
# 
# IANYWHERE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT 
# THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR 
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
# PURPOSE, OR NON-INFRINGEMENT. IANYWHERE SHALL NOT BE 
# LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT 
# OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR 
# ITS DERIVATIVES.