Snuggle has asked for the wisdom of the Perl Monks concerning the following question:
Monks, I bow to your buddha nature....
I ran into an interesting problem today. I am recieveing information from a cookie that is formatted in the following way:
Anyway, no drug, not even alcohol, causes the fundamental ills of society. If we're looking for the source of our troubles, we shouldn't test people for drugs, we should test them for stupidity, ignorance, greed and love of power.
--P. J. O'Rourke
this looks like a hash to me so I attempted to copy the cookie string to a variable like so:name1,value1,name2,value2....etc.
so now $cookie has one long string with all the data separated by commas. Now, I append ()'s and quotes in all the right places, and I have a string that says something like this:my $rep= new CGI; my $cookie = $rep->cookie("cookiename");
Setting my hash equal to this never worked right, I suspect that it has something to with the fact that the equal operator does not take the string as a literal and instead put the whole string in the first key. Is there any way to have a hash look at a string in the literal sense, or do I have to split the string into an array and hash it from there? Thanks("Name1","Value1","Name2","Value2")
Anyway, no drug, not even alcohol, causes the fundamental ills of society. If we're looking for the source of our troubles, we shouldn't test people for drugs, we should test them for stupidity, ignorance, greed and love of power.
--P. J. O'Rourke
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Hashes and Cookies (or more to the point, strings)
by bikeNomad (Priest) on Jul 19, 2001 at 19:23 UTC | |
Re: Hashes and Cookies (or more to the point, strings)
by lhoward (Vicar) on Jul 19, 2001 at 19:23 UTC | |
Re: Hashes and Cookies (or more to the point, strings)
by mikeB (Friar) on Jul 19, 2001 at 19:32 UTC |
Back to
Seekers of Perl Wisdom