On Mon, Jan 29, 2001 at 05:31:52PM +0100, Philip Newton wrote:
> Reminds me of fits I had when doing Vignette/Tcl with lists of lists that I
> passed to another template with HTTP POST. When the list of lists contained
> only one element, it didn't wrap that list in extra {} so the foreach say a
> list of lists all right -- but the "sublists" were only one element long
> (since {} are optional around lists if there are not spaces). Caused me a

Try creating a JavaScript array of length one whose first
element is initialised to 1.  Aaargh. [1]

Paul


[1]

# These numbers get turned into a JavaScript array later on that
# looks like new Array (1,1,0); Owing to JavaScript1.0 braindeadedness
# new Array (1) is interpreted as "created a one element list" not
# "create a one element list with [0]=1". However this is achievable
# if the number is given as a string like new Array("1");

@time_names = sort {$a <=> $b} keys %time_names;
foreach my $i_list (keys %time_cache) {
        $time_cache{$i_list} =
                join ',', map {$time_cache{$i_list}{$_} ? 1 : 0} @time_names;
        $time_cache{$i_list} =~ s/^(.)$/"$1"/;
}

Reply via email to