if ($name gt 'fred') {
print "'$name' comes after 'fred' in sorted order. ";
}
Back
Operator Precedence
Front
2+3*4
Back
single-quoted string literal
Front
A sequence of characters enclosed in single quotes.
Back
floating-point literals
Front
Numbers with and without decimal points are allowed (including an optional plus or minus prefix), as well as tacking on a power-of-10 indicator with E notation
Back
The "leading zero" indicator works only for __________
Front
literals
Back
Perl allows you to add __________ for clarity within integer literals.
Front
underscores
Back
A literal is __________
Front
how you represent a value in your source code -- it's data that you type directly into your program.
Back
left associativity
Front
Proceed front to back.
Use parentheses when you don't remember the order of operations.
Back
Perl computes with _________ values
Front
double-precision floating-point values
Back
The oct( ) function
Front
oct('0377') # 255 decimal
(only works on strings)
Back
-M
Front
Load the pragma only when needed.
$ perl -Mdiagnostics ./my_program
Back
diagnostics pragma
Front
Get a longer description of the problem.
use diagnostics;
Back
empty string
Front
has no characters
Back
All numbers have (the same / different) formats internally.
Front
the same
Back
Comparison Operators
Front
< <= == >= > !=
Each of these returns a true or false value.
Back
The advantage of warnings over -w
Front
You only turn on warnings for the file in which you use the pragma, whereas -w turns on for the entire program.
Back
-w
Front
$ perl -w my_program
(Turns on warnings from the command line or sh-,bang line.)
line: #!/usr/bin/perl -w
Back
Perl identifier
Front
A letter or underscore, and then possibly more letters, or digits, or underscores.
Back
strings
Front
Sequences of characters, such as hello or ☃★๛
Back
Hexadecimal literals start with a __________ and use _________
Front
leading 0x and use the digits 0 to 9 and the letters A through F (or a through f) to represent the values from 0 to 15
Back
say
Front
use v5.10;
say "The answer is ", 6 * 7, '.';
Back
Octal (base 8) literals start with a __________ and use the digits from ___ to ___.
Front
leading 0 and use the digits from 0 to 7
Back
assignment
Front
The way to give a value to a variable. Takes a variable name on the left side, and gives it the value of the expression on the right.
Back
Variable
Front
Name for a container that holds one or more values.
Back
Binary (base 2) literals start with a leading _____ and use __________.
Front
0b and use only the digits 0 and 1
Back
else
Front
if ($name gt 'fred') {
print "'$name' comes after 'fred' in sorted order. ";
} else {
print "'$name' does not come after 'fred'. "; print "Maybe it's the same string, in fact. ";
}
Back
pragma
Front
Something that tells the Perl compiler how to act.
Back
the utf8 pragma
Front
use utf8;
Enables you to use Unicode characters in your program.
Back
operators
Front
Perl's verbs -- They decide how to treat the nouns.
Back
variable interpolation OR double-quote interpolation
Front
meal = "brontosaurus steak"; $barney = "fred ate a $meal";
# $barney is now "fred ate a brontosaurus steak"
Another way to write that:
barney = 'fred ate a ' . $meal; #