[LON-CAPA-users] passing variables by ref in problem

H. K. Ng lon-capa-users@mail.lon-capa.org
Mon, 07 Feb 2005 12:34:25 -0500


Hi Guy,

My mistake - didn't realize that

$eqn0 = &poly_xn([\$d,\$c,\$b,\$a],'x');

is a double ref for variables $d, $c ..

-hk

At 11:48 AM 2/7/2005, you wrote:
>Hi Hon-Kie,
>
> > It seems that when variables are passed to a sub routine by ref, the sub
> > routine cannot de-ref the variables. Is there a way to fix this?
>
>Works fine for me:
><problem>
><script type="loncapa/perl">
>$test="starting"
></script>
><startouttext />test value is $test<br /><endouttext />
><script type="loncapa/perl">
>sub change {
>     my ($ref)=@_;
>     $$ref="finished";
>}
>&change(\$test);
></script>
><startouttext />test value now is $test<endouttext />
></problem>
>
>In what way is it not working for you?
>
>
>--
>guy@albertelli.com  LON-CAPA Developer  0-7-3-2-
>_______________________________________________
>LON-CAPA-users mailing list
>LON-CAPA-users@mail.lon-capa.org
>http://mail.lon-capa.org/mailman/listinfo/lon-capa-users