Posted on 2007-02-26 17:50:00-08 by bigj26
Saving Array Reference in session->param.
Hi, hopefully somebody might help me. I am debugging a code, which actually had worked before with an older CGI-SESSION version. I have just one question, where I don't find an answer for in the books I borrowed. I have 2 subroutines: Nr.1:
sub 1{ my @selectedkeys = ('bla', 'blub'); $session->param('selectedkeys' => \@selectedkeys); }
Nr.2:
sub 2{ my $output = $session->param('selectedkeys'); print @$output }
So in Subroutine 1, an array is created and filled with information. Then the address of the reference is passed to
$session->params
. When I use sub2 now, and looking at the address, it differs from the address I got in subroutine 1. Also the dereferencing via
@$output
is empty. My question is, if PERL destroys the
my @selectedkeys Array
, after subroutine 1 is finished and if that is why the derefence is empty? Hopefully somebody might be able to help me. Thank you very much.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.