Difference between revisions of "Basic Perl syntax"
Jump to navigation
Jump to search
Line 21: | Line 21: | ||
$sref = \$scalar; |
$sref = \$scalar; |
||
| |
| |
||
− | $aref = ~@array; |
+ | $aref = ~~@array; |
− | $href = ~%hash; |
+ | $href = ~~%hash; |
− | $sref = ~$scalar; |
+ | $sref = ~~$scalar; |
|} |
|} |
Revision as of 18:54, 3 March 2008
The PG Language is based on Perl. It helps to have a basic grasp of Perl before you start authoring PG problems. This article covers the minimum of Perl you need to know to work with PG. (The following is excerpted from the perlintro
manual page.)
Important changes from vanilla Perl
If you already know Perl, this is all you need to know:
Because backslashes have a special meaning within BEGIN_TEXT...END_TEXT
blocks, backslashes are not used for their normal Perl meaning. Instead, ~~
(double-tilde):
Perl | PG |
---|---|
print "Hello, $name\n"; |
print "Hello, $name~~n"; |
$aref = \@array; $href = \%hash; $sref = \$scalar; |
$aref = ~~@array; $href = ~~%hash; $sref = ~~$scalar; |