Re: [Cgi-session-user] Storing/retrieving a hash (element)
Brought to you by:
sherzodr
From: Jonathan M. <jon...@co...> - 2006-09-09 19:53:59
|
----- Original Message ----- From: "Mark Stosberg" <ma...@su...> To: "Jonathan Mangin" <jon...@co...> Cc: "List - CGI-Session" <cgi...@li...> Sent: Saturday, September 09, 2006 4:17 PM Subject: Re: [Cgi-session-user] Storing/retrieving a hash (element) > Jonathan Mangin wrote: > > Hi all, > > > > I'm storing a hash (test_time) in the session. > > It appears correct, but please tell me if this is wrong. > > > > $session->param('uid' => $uid, > > 'test_time' => {'e1' => $row[9], > > 'e2' => $row[10], > > 'e3' => $row[11], > > 'e4' => $row[12], > > 'e5' => $row[13], > > 'e6' => $row[14], > > 'e7' => $row[15]}); > > > > The real problem is I can't figure out how to retrieve > > any _one_ of the test_time elements. Can someone clue > > me in? > > Hello Jon, > > The answer is not specific to CGI::Session, but is one of how Perl's > data structures work. I recommend this: > > my $href = $ses->param('test_time'); > print $href->{e1}; > > This may also work: > > print $ses->param('test_time')->{e1}; This is the example I needed, thanks so much. Works great, BTW. > > But I haven't tested it and find it less clear. > > Mark > > -- > http://mark.stosberg.com/ > |