[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] perl error setting scratch variable
> -----Original Message-----
> From: interchange-users-admin@interchange.redhat.com
> [mailto:interchange-users-admin@interchange.redhat.com]On Behalf Of
> Kevin Walsh
> Sent: Friday, April 12, 2002 1:33 PM
> To: interchange-users@interchange.redhat.com
> Subject: RE: [ic] perl error setting scratch variable
>
>
> >
> > If anyone can look at this and tell me where the error is I would really
> > appreciate it.
> > Here is the code:
> >
> > [perl tables="userdb"]
> > @subscriptions = split(/\s+/, $Tag->data('userdb', 'mail_list',
> > $Values->{mv_username});
> > foreach $my_item (@subscriptions) {
> > $Tag->set('subscriptions', $my_item . '=Y' );
> > }
> > [/perl]
> >
> Change that set() thing to this:
>
> $Scratch->{subscriptions} .= "$my_item=Y";
>
> ...that seems to be the intent of your code, but you will end
> up with a string like this:
>
> foo=Ybar=Yhello=Yworld=Y
>
> I said 'intent' because each iteration of your loop would
> just overwrite the previous value and seems wrong to me.
>
> What is it that you're trying to do?
hrrmmm... no I was hoping that each iteration would create a new scratch
variable.
something similar to this:
[set subscription]
item_1=Y
item_2=Y
item_4=Y
[/set]
I thought you used [set] to set scratch variables?
I guess to get what i want working i would want to do this then:
$Scratch->{$my_item} = 'Y'
for each iteration.
thanks!
mike k.
>
> By the way, the syntax error is probably caused by the lack of a
> closing bracket on the @subscriptions line. You seem to have
> a mismatch there.
>
> --
> _/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
> _/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
> _/ _/ _/ _/ _/ _/ _/ _/_/ kevin@cursor.biz
> _/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users
>