passing references | topic started 7/23/2005; 1:18:07 PM last post 7/23/2005; 2:46:14 PM |
|
Michael Gage - Re: passing references 7/23/2005; 2:46:14 PM (reads: 1062, responses: 0) |
The documentation is quite old but there are a few references. One is
http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/tutorial/perlbasics
but it only refers to this item indirectly. Also http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/pod/pgtranslator When a .pg problem is read every occurence of a backslash is replaced by a double backslash. This protects the use of the backslash for TeX commands. Then every occurence of the double tilde is replaced by a backslash. This allows you to use references to arrays and hashes and so forth. This can be a nuisance because in the .pl file that often contain macros this kind of preprocessing does not occur. Hence in a .pg file you use
$ra_foo= ~~@array_foo: in the .pl file you use $ra_foo = @array_foo; Likewise "\( \int x^2 dx \)" works fine in a .pg file but must be written as "\\( \\int x^2 dx \\)" in a .pl file. The logic behind this is that TeX is used a lot in .pg files, but not so often in .pl files. The reverse is true about using the perl version of backslash. Hope this helps. -- Mike |