Help with perl session cookie

I am having a problem with login on one of my scripts. It seems that users are not being assigned unique cookies. Whenever two people use the software on the same network it gets them confused. Can anyone tell me how to modify below?

require “$basedir/tempfiles/modules/token.mod”;

get data from login form then set user data token

if ($FORM{‘username’} ne “”) { $setmytoken =1; }
if ($FORM{‘password’} ne “”) { $setmytoken =1; }
if ($setmytoken ==1) { &setmytoken; }

nonetheless get user data token info and setup username and password veriables

if ($FORM{‘co’} eq “signoff”) { &clearmytoken; }