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:
name1,value1,name2,value2....etc.
this looks like a hash to me so I attempted to copy the cookie string to a variable like so:
my $rep= new CGI; my $cookie = $rep->cookie("cookiename");
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:
("Name1","Value1","Name2","Value2")
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

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

In reply to Hashes and Cookies (or more to the point, strings) by Snuggle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.