I have used session variables in Java before and i am wonder how to do it in perl. I am using apache/perl/mysql. On index.html a user enters login info into the form. It calls a login.pl script which verifies the login info in the owners table. that all works fine. But now I want to store the userid in a session variable so that the logged in user can access his/her profile in the profile table.

Here are some snipets of code:
<FORM ACTION="/cgi-bin/login.pl" METHOD="POST">
<td width="70">Username:</td>
<td width="180"> <INPUT TYPE="TEXT" NAME="username" size="20"></td>
<td width="70">Password:</td>
<td width="180"> <INPUT TYPE="PASSWORD" NAME="password" </td>
<INPUT TYPE="SUBMIT" Value="Login">

# Get username and password from login form
my $username = param( "username" );
my $password = param( "password" );

# Validate username and password
my @array;
my $validusername = "False";
my $validpassword = "False";
while ( @array = $sth->fetchrow_array() ) {
if ( $array[0] == $username ) {
$validusername = "True";
if ( $array[1] eq $password & $validusername eq "True" ) {
$validpassword = "True";

# Display Login Accepted HTML Layout
if ( $validpassword eq "True" ) {
<FORM ACTION="/cgi-bin/myprofile.pl?username=$username" METHOD="POST">
<td width="100" height="20"><b><font face="Verdana" size="2">View Profile:</font></b></td>
<td width="180" height="20"> <INPUT TYPE="SUBMIT" Name="profile" Value="view profile"></td>

In myprofile.pl it does not display the user information. The subsequent generated address is indeed myprofile.pl?username=loggedinuser but none of the information in the body of the page is there. Help.