PERL Handout January 17 (due January 20)
Review Questions
2. How would you create an infinite loop with the for statement?
With the while statement?
3. What are the three keywords used in conditional statements?
EXPRESSION if (CONDITION);
Exercises
(The next two are optional)
#!/usr/bin/perl
@a=(Lbzjoftt,Inqbujfodf,
Hvcsjt); $b="Lbssz Wbmm"
;$b =~ y/b-z/a-z/ ; $c =
" Tif ". @a ." hsfbu wj"
."suvft pg b qsphsbnnfs"
. ":\n";$c =~y/b-y/a-z/;
print"\n\n$c ";for($i=0;
$i<@a; $i++) { $a[$i] =~
y/b-y/a-z/;if($a[$i]eq$a
[-1]){print"and $a[$i]."
;}else{ print"$a[$i], ";
}}print"\n\t\t--$b\n\n";
You can find this program in my directory heres the path:
/usr/users3/grovesr/web/cgi-bin/larry.pl