
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Possible minor bug (?): '-' and $Scratch->{var-name}
At 11:28 AM 8/24/01, you wrote:
>Hi all -
>
>Working on some code in an IC 4.6.5 catalog, I found that I could set and
>view the contents of a scratch variable which contains a dash in its name
>using IC tags:
>
>[set var-name]something[/set]
>[scratch var-name]
>
>but operations failed within a Perl block:
>
>[set var-name][/set]
>[perl]
> $Scratch->{var-name} = "foo";
> return;
>[/perl]
>[scratch var-name]
>
>In the latter example, var-name remains empty; no message in the error
>log. Removing the dash from var-name fixes the problem instantly. It
>also fixes the problem to enclose the var-name in single quotes:
>
>[perl]
> $Scratch->{'var-name'} = "foo";
> return;
>[/perl]
>
>...and furthermore, using an underscore instead of a dash works. This is
>pretty minor, but has me wondering; is this a side-effect of code intended
>for other purposes or an undocumented character usage restriction?
>
>- Ed L.
>
Ed,
Actually this is a perl question:
quoted from O'REILLY "Programming perl" :
--------------------------------------------------
$days{'Feb'}
can be written as:
$days{Feb}
and the quotes will be assumed automatically. But anything more complicated
in the
subscript will be interpreted as an expression.
------------------------------------------------
So in your case perl is trying to evaluate var-name which of course makes
no sense and thus fails.
Kyle Cook
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users