
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

























COMP 524 Programming Language Concepts Aaron Block February 1, 2007
Based on notes by N. Fisher, F. Hernandez-Campos, and D. Stotts
2
4
while($d<37){ $d++; }^ $sum^ +=^ $d;
until($d>=37){ $d++; }^ $sum +=^ $d;
5
do{ $d++; } $sumwhile^ += ($d<37);^ $d;
do{ $d++; } until ($d>=37);^ $sum +=^ $d;
7
open(INDATA, “index.html”); #reading open(INDATA, “>index.html”); #writing open(INDATA, “>>index.html”); #appending
open(INDATA, close(INDATA); “index.html”) || die “Error”;
8
open(INDATA, $in =
close(INDATA)^ #all_in[1]^ =^ second line
10
open(OUTDATA, print OUTDATA ">index.html")“Out”; close(OUTDATA);
11
print STDOUT “Out”;
13
print $retValue &aFunct(12,5); = &aFunc(12,5); aFunc(12,5); $x = noArgs(); $x = &noArgs;
14
/.at/ /[aeiou]/ #matches #matches single character “cat”, “bat”, but not “at” /[0-9]/ /[0-9]/ #match one char #match zero or more chars from range /[^0-9]/ /cmp/ #“cccmp”, #match zero or more chars NOT in range “cmp”, “mp”, NOT “cp” /a+t/ /a?t/ #“aaat”,#zero or “at”, “t”one “a”s, “at” or “t” not “aaaat” /^on/ /on$/ #start... “on the” NOT “the#end... “the on” not “on the” on” /cat/i /**/ #ignore#match “**”case
16
$a = $a =~ “Hello s/World/Mars/; World World”; print ($a. “\n”); #Print “Hello Mars World”
$a = $a =~ “Hello s/World/Mars/g; World World”; print ($a. “\n”); #Print “Hello Mars Mars”
17
$a = $a =~ “Hello s/world/Mars/i; World World”; print ($a. “\n”); #Print “Hello Mars World”
$a = $a =~ “Hello s/world/Mars/gi; World World”; print ($a. “\n”); #Print “Hello Mars Mars”
19
system(“ls”); #runs “ls”
$retVal print “$retVal\n”; #Prints working Dir. = pwd;
20
$pid while(
$pid $a = =ls; open(SINK, “| more”) || die “oops\n”; print close(SINK) SINK $a; || #Pipes output fromdie “oops again\n”; “ls” into “more”