## Forum archive 2000-2006

### Andy Wildenberg - Perl primer

by Arnold Pizer -
Number of replies: 0
 Perl primer topic started 2/20/2001; 11:12:11 AMlast post 3/30/2001; 2:34:54 AM
 Andy Wildenberg - Perl primer  2/20/2001; 11:12:11 AM (reads: 1416, responses: 2) Is there a good online Perl primer people would recommend? I remember there used to be a reasonable Perl 101 sort of document on this site, but it's been replaces with a 1 page HTML file that doesn't tell enough to be useful. For example, I found the code for a simple for loop from the primer. But what are the basic string manipulation commands? It's hard to learn Perl when you've got to get it through the PG compiler first :-) Also, are there any restrictions as to the kinds of Perl things you can do inside a PG file? For example, is it okay to wrap a for loop around a BEGIN/END TEXT? How about include a BEGIN/END Text and/or ANS macro in a 'sub' function definition? <| Post or View Comments |>

 Michael Gage - Re: Perl primer  2/20/2001; 11:44:26 AM (reads: 1642, responses: 0) 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 |>

 Lars Jensen - Re: Perl primer  3/30/2001; 2:34:54 AM (reads: 1686, responses: 0) This tutorial is not bad: Lars. <| Post or View Comments |>