Learning Perl by By Randal L. Schwartz & Tom Christiansen
-- the Llama book
( http://www.oreilly.com/catalog/lperl2/)
is an excellent book and will tell you more than you need to know to
get started with perl and PG problems. (Programming Perl -- the Camel
book-- is more of a reference than a tutorial and is also excellent).
On this site the Newbie guide by Shemanske tells a little bit about
perl syntax while explaining some of the tutorial problems clearly.
(http://hilbert.dartmouth.edu/webwork_local_html/). A very short
page on syntax -- more suitable for a reading knowledge of perl than for writing in perl -- is Basic Perl Syntax
As for the PG precompiler -- the only really important difference is
that backslashes are protected in PG. This means that within quotes
you can write "\alpha" and get an alpha character TeX command. (In perl
you would have to write " \\alpha ". The other difference is that
in PG you must use ~~@array to get a reference to the array (while in perl you would use \@array).
The BEGIN_TEXT / END_TEXT construction is explained more fully
on the page The problem text
and is syntatic sugar for the subroutine call: TEXT(EV3(<<'END_TEXT')); problem text goes here ... END_TEXT
For the rest, all of the PG "verbs" are just perl subroutines defined
in one of the macro files. The perl commands which reference the disk
and IO are restricted. You can't use "system", or "require" or even
"print" or "eval" for security reasons. (You can use
PG_restricted_eval() in place of "eval". )
-- Mike
<| Post or View Comments |>
|