[ic] Perl / Session question

Stefan Hornburg racke at linuxia.de
Thu Apr 15 04:27:53 EDT 2004


On Wed, 14 Apr 2004 17:42:58 -0700
"interchange at thedesignpeople.com" <interchange at thedesignpeople.com> wrote:

> Could someone knowledgable in perl be kind enough to help me out here.
> 
> I have discovered that this works to manually set the discount:
>    $Session->{discount} = ({
>                      'code1' => '199',
>                      'code2' => '199',
>                      'code3' => '199'
> 			});
> 
> I thought the following would have the same effect but does not work:
> # create empty array
> @arrayval = ();
> # create a hash
> $hashval = {
>            'code1' => '199',
>            'code2' => '199',
>            'code3' => '199'
>            };
> # put the hash into an array
> push @arrayval, $hashval;
> 
> $Session->{discount} = @arrayval;
> 
> The script dies with the following error:
> Runtime error: Can't use string ("1") as a HASH ref while "strict refs" 
> in use at /www/interchange/interchange-5/lib/Vend/Interpolate.pm line 5151.
> 
> I'm not sure what this error means.
> Can someone please explain what I'm doing wrong?

$Session->{discount} = $hashval;

Although doing tricks like that are not for the unwary and may break
on later versions of Interchange.

	Racke



-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the interchange-users mailing list