Chapter 2-3 Flashcards
1
Q
== or eq
A
exactly equal to
2
Q
!=
A
not equal to
3
Q
ne
A
not equal to
4
Q
if loop
A
if ($hour == 12) {
print “Lunchtime!\n”;
}
5
Q
if/else loop
A
if ($hour == 12) { print “Lunchtime!\n”; } else { print “I'm hungry.\n”; }
6
Q
if/elsif/else loop
A
if ($hour == 12) { print “Lunchtime!\n”; } elsif ($hour == 6) { print “Dinner!\n”; } else { print “I'm hungry.\n”; }
7
Q
while loop
A
while ($hour
8
Q
for loop
A
for ($hour = 0; $hour
9
Q
foreach loop
A
foreach $icount (10..1) {
print “$icount “;
}
print “Blastoff.\n”;
10
Q
Functions– things that
A
- do something to their inputs
- then return the result
- use () to hold their goodies.
11
Q
function with return value
A
$return_value = function_name($var1, $var2, $var3);
12
Q
@icount = (1, 2, 3, 4, 5);
A
building a list of items
13
Q
List =
A
an ordered collection of scalars
14
Q
Array =
A
ordered collection of scalars
15
Q
Indices always start at
A
0