[ic] Array of Hashes

Rick Bragg lists at gmnet.net
Tue May 18 20:10:46 UTC 2010


Hi,

I want to be able to store an array of hashes in the session, but it
seems I am having trouble with this.  My problem is how do I store a
hash in the session for later? and how do I access this later on?

i.e. storing:

The array would be something like the following:

[calc]
@AoH = (
    {  sku => "item_101",  color => "green", },
    {  sku => "item_102",  color => "blue", },
    {  sku => "item_103", color => "red", },
    {  sku => "item_104",  color => "gray", },
);
$Scratch->{saved_item_hash} = join(' ', @AoH);
return;
[/calc]


Then somewhere else on the page access again later somehow with:
[calc]
  my @AoH = split(' ',$Scratch->{saved_item_hash});
[/calc]

I know this is wrong, but any ideas or best practice for this?

Thanks
Rick







More information about the interchange-users mailing list