Section 1

Preview this deck

ord( )

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (81)

Section 1

(50 cards)

ord( )

Front

Turns a character into its code point.

Back

if control structure

Front

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; #

Back

compound assignment operator

Front

$fred = $fred + 5; $fred += 5; $str = $str . " "; fred **= 3

Back

exponentiatial operator

Front

2**3, is two to the third power, or eight.

Back

modulus operator (%)

Front

The value of the expression 10 % 3 is the remainder when 10 is divided by 3, which is 1.

Back

escape

Front

'Don\'t let an apostrophe end this string prematurely!'

Back

sigil

Front

The $ that indicates a scalar variable

Back

hexadecimal floating-point literals

Front

Instead of an e to mark the exponent, you use a p for the power of 2 exponent. Just like the hexadecimal integers, these start with 0x: 0x1f.0p3

Back

string comparison operators

Front

lt, le, eq, ge, gt, and ne

Back

code point

Front

$alef = chr( 0x05D0 ); $alpha = chr( hex('03B1') ); $omega = chr( 0x03C9 );

Back

An integer constant in the program is treated as

Front

the equivalent floating-point value

Back

scalar data

Front

The values themselves.

Back

scalar

Front

A single thing -- the simplest kind of data that Perl manipulates.

Back

right associativity

Front

Proceed back to front. Use parentheses when you don't remember the order of operations.

Back

print

Front

print "The answer is "; print 6 * 7; print ".
"; print "The answer is ", 6 * 7, ".
";

Back

The hex( ) function

Front

hex('DEADBEEF') # 3_735_928_559 decimal (only works on strings)

Back

Octal, hexadecimal, decimal and binary numbers are __________ to Perl.

Front

all the same

Back

<STDIN>

Front

standard input A line-input operator working on the filehandle STDIN

Back

E notation

Front

(also known as exponential notation).

Back

scalar variables

Front

Containers which can store a scalar value.

Back

\x{}

Front

hexadecimal representation "\x{03B1}\x{03C9}"

Back

Section 2

(31 cards)

double-quoted string literal

Front

A sequence of characters enclosed in double quotes.

Back

/t

Front

Tab

Back

/e

Front

Escape

Back

The defined Function

Front

$next_line = <STDIN>; if ( defined($next_line) ) { print "The input was $next_line"; } else { print "No input available!
"; }

Back

\u

Front

Uppercase next letter

Back

\L

Front

Lowercase all following letters until \E

Back

\\

Front

Backslash

Back

string repetition

Front

"fred" x 3 # is "fredfredfred"

Back

/b

Front

Backspace

Back

/r

Front

Return

Back

\x7f

Front

Any hex Unicode code point (here, U+2744 = snowflake).

Back

\Q

Front

Quote nonword characters by adding a backslash until \E

Back

The chomp Operator

Front

If the string ends in a newline character, chomp( ) removes that newline. text = "a line of text
"; chomp($text); chomp($text = <STDIN>);

Back


Front

Perl does not interpret the
within a single-quoted string as a newline, but as the two characters backslash and n.

Back

Control-C

Front

Control-C will stop a runaway program.

Back

Double-quoted string backslash escapes

Front

Backslash followed by a letter inside double quote marks to indicate some kind of action.

Back

backslash escape

Front

Can precede many characters to mean something other than their literal representation.

Back

variable interpolation

Front

Some variable names within the string are replaced with their current values when the strings are used.

Back

/a

Front

Bell

Back

\"

Front

Double quote

Back

\N{CHARACTER NAME}

Front

Any Unicode code point, by name.

Back

/f

Front

Formfeed

Back

\l

Front

Lowercase next letter

Back

/007

Front

Bell (any octal character)

Back

the . operator

Front

Concatenate, or join, string values with the . operator.

Back

\cC

Front

A "control" character (here, Ctrl-C).

Back

\E

Front

End \L, \U, or \Q

Back

The undef Value

Front

Just Perl's way of saying, "Nothing here to look at — move along.

Back

undef operator

Front

next_line = undef; # As if it had never been touched

Back

\U

Front

Uppercase all following letters until \E

Back

The while loop

Front

$count = 0; while ($count < 10) { $count += 2; print "count is now $count
"; # Gives values 2 4 6 8 10 }

Back