in reply to CGI cookie turns array ref into string

You can serialize array before storing it as cookie. If array contains only numbers you can do it like this:

my $porder = join ",", @{gen_order(30)};
and later restore array using split:
my @porder = split /,/, $info{'porder'};
But generally I would prefer CGI::Session for storing data locally.