Perl Variables and Types

Perl Variables and Types

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

=

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 (16)

Section 1

(16 cards)

=

Front

assigns values to a variable; operand to the left of the sign is the name of the variable, and the operand to the right is the value stored in the variable

Back

Does Perl have a Boolean type?

Front

no

Back


Front

newline character

Back

;

Front

required to end a Perl statement

Back

=

Front

lines starting with these are interpreted as the start of a section of embedded documentation (pod - plain old text) example: =begin comment This is all part of multi line comment. You can use as many lines as you like. These comments will be ignored by the compiler until the next =cut is encountered. =cut

Back

#

Front

starts a comment

Back

$

Front

called scalars; they contain a single string or numeric value; perl variable must start with one of these

Back

Is Perl case sensitive?

Front

yes

Back

%

Front

called hashes; contain (key, value) pairs efficiently accessed per key

Back

""

Front

used to encapsulate a string to be printed, and it allows replacement of variables and special characters (like
) inside the string; also known as interpolation (because you place it in between them); double quotes also allow the variable named x to show its real value of $x

Back

to refer to a single element of a hash, the variable name must start with a ___ followed by the key of the requested element in ___ there are other ways, but you can specify the key value pairs with the key => value syntax

Front

1. % 2. {}

Back

=cut

Front

all subsequent lines of "=" until the next of these are ignored by the compiler example: =begin comment This is all part of multi line comment. You can use as many lines as you like. These comments will be ignored by the compiler until the next =cut is encountered. =cut

Back

'

Front

prevents variable value replacement; with single quotes, the value of $x is not replaced
'

Back

to refer to a single element of an array, the variable name must start with a ___ followed by index of the element in ____ index of the first array element is 0

Front

1. $ 2. [ ]

Back

@

Front

called arrays; contain a randomly accessed ordered set of values; perl variable must start with one of these

Back

print

Front

prints a command; parenthesis are not required

Back