in reply to Hashes and Cookies (or more to the point, strings)

The problem is that the assignment isn't parsed as it would be in your source text. The fastest thing to do is to split it:

my $cookie = 'name1,value1,name2,value2'; my %hash = split(',', $cookie);

Or you can use string eval on your quoted string (but why?):

my $cookie = '("Name1","Value1","Name2","Value2")'; my %hash = eval $cookie;

update: But don't do that. As crazyinsomniac points out, it's not a really good idea to eval cookie contents...