sub retrieve_cookie
{
 my($ss) = shift;		# Which cookie do we want to fetch ?
 my (%cookies,$cookie);	# Declare our variables as local.
 
 # Get a hash of raw cookie data:
 %cookies = fetch CGI::Cookie;


	# Loop over each cookie in the raw cookie data (%cookies), and do the following:

	# 1. If the cookie matches the one we want:
	#	a. Get rid of the cookie name (ie. "gwad=").
	#	b. Get rid of the path from the cookie.
	#	c. Convert any plus signs "+" to spaces.
	#	d. Replace any hex encoded characters (e.g "%20") with the appropriate characters.

	# 2. Now we just return the filtered cookie that was requested.

 foreach (keys %cookies){
  if ($cookies{$_} =~ /$ss/){
   $cookie = $cookies{$_};
   $cookie =~ s!^$ss=!!i;
   $cookie =~ s!\;\spath=.*$!!i;
   $cookie =~ tr/+/ /;
   $cookie =~ s!%([a-fA-F0-9][a-fA-F0-9])!pack("C", hex($1))!eg;
  }
 }
 return $cookie;
}
1;