CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Cookies and text with milk.



Jan 31, 2000, 10:57 PM

Post #1 of 2 (2516 views)
Cookies and text with milk. Can't Post

Hello! I downloaded Matt Wright's
cookie-lib and I am attempting
to set a cookie with the value
of a login id.
$usrname = "someuser_from_succesful_login";
The problem is it will read the cookie
as $usrname! Not the value of $usrname but just $usrname.


Feb 1, 2000, 3:28 PM

Post #2 of 2 (2516 views)
Re: Cookies and text with milk. [In reply to] Can't Post

The problem is that you have '$usrname' in between single quotes. If you want to interpolate the scalar (get the value of $usrname), then enclose it in double quotes.

Using single quotes around a scalar or other variable will tell Perl to treat the text within it literally.


'$username' is treated literally as $username

"$username" has a special character in it, so Perl interpolates it and gives you the value of $username, instead of the word $username

Simple change the &SetCookies line to:


Also, in the way you're using the scalar (as a lone variable being passed to a subroutine), you can omit the quotes completely and use:


Good luck!

[This message has been edited by Jasmine (edited 02-01-2000).]


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives