[LON-CAPA-dev] Re: [LON-CAPA-cvs] cvs: loncom /auth lonacc.pm

Guy Albertelli II lon-capa-dev@mail.lon-capa.org
Mon, 25 Feb 2002 16:52:42 -0500 (EST)


Hi Gerd,

> +                  $ENV{"form.$name"}.=','.$value;

This is lame, use a perl array.

   if ($ENV{"form.$name"}) {
	if (defined(@{ $ENV{"form.$name"} })) {
	    #already have multiple values
	    push(@{ $ENV{"form.$name"} },$value);
	} else {
	    #first multiple values, convert to array
	    my $first=$ENV{"form.$name"};
	    undef($ENV{"form.$name"});
	    push(@{ $ENV{"form.$name"} },$first,$value);
	}
    } else	{
	$ENV{"form.$name"}=$value;
    }



And you easily get acces

my @localarray=@{ $ENV{"form.name"} };


-- 
albertel@msu.edu        BM: n^20 t20 z20 qS 
Guy Albertelli -7-9-8-  O-
    Having control over myself is nearly as good as having control
    over others.