pccode
09-24-2005, 08:43 PM
I'm currently using the code below to retrieve specific information from a cookie.
use CGI::Cookie;
%cookies = fetch CGI::Cookie;
my $isset = $cookies{'user'};
my @temp1 = split(/\;/, $isset);
my @temp2 = split(/=/, $temp1[0]);
my $username = $temp2[1];
I don't have a lot of experience with perl, but I'm sure there's an easier way to retrieve a cookie value. The code above is used to retrieve a cookie named user. Then I need to retrieve the value from that cookie named username. Unfortunately the only way I know how to do this is by splitting the $isset variable. Any suggestions?
use CGI::Cookie;
%cookies = fetch CGI::Cookie;
my $isset = $cookies{'user'};
my @temp1 = split(/\;/, $isset);
my @temp2 = split(/=/, $temp1[0]);
my $username = $temp2[1];
I don't have a lot of experience with perl, but I'm sure there's an easier way to retrieve a cookie value. The code above is used to retrieve a cookie named user. Then I need to retrieve the value from that cookie named username. Unfortunately the only way I know how to do this is by splitting the $isset variable. Any suggestions?