[ic] How to use Variable in perl?

Interchange User interchange-users@icdevgroup.org
Fri Jul 19 16:58:01 2002


On Saturday 20 July 2002 04:07, you wrote:
> Quoting Interchange User (inter@myoccasion.com):
> > I have a Variable definition in catalog.cfg, like this:
> > Variable        GOLD    Gold
> >
> > To use this variable in a html page, it's simply:
> > Gold = __GOLD__
> >
> > right?  But how can I use it in a perl block?  Eg, a snippet:
> >
> > [perl arg="values scratch"]
> >   $b = "";
> >   $b .= "membership_type=";
> >   $b .= "__GOLD__";
> >   $Scratch->{b} = $b;
> >   return;
> > [/perl]
> > [scratch b];
> >
> >
> > Of course, the above perl block does not work.  What could be
> > wrong? I think this should be very simple, but I just couldn't
> > figure that out.
>
> The arg="values scratch" stuff no longer is needed. Try this:
>
> [calc]
>   $Scratch->{b} = "membership_type=$Variable->{GOLD}";
>   return;
> [/calc]
> [scratch b]
>
> This would work in ITL:
>
>     [seti b]membership_type=__GOLD__[/seti]

Thank you so much!!  :)  It worked!
I knew it would be something simple like this, but $Variable in perl 
doesn't seem to be documented, that's why.

Anyway, my above code was only part of the perl block.  There were 
other perl statements above and below it, that's why I wouldn't want 
to use [calc] and [seti].