Basic Perl Programming - Glossary

Back to Java Glossary
A B C D E  F G H  I J K  L M N O P Q R  S T U V W X Y Z 
Perl is a well-established programming language that has been developed through the time and effort of countless free software programmers into an immensely powerful tool that can be used on pratically every operating system in the world. Perl started out as the "Swiss army knife" of computer languages and was used primarily by system administrators, but over time it has grown into an immensely robust language used by web-developers and programmers worldwide. Perl is a great way to learn programming techniques and develop your own style of coding.
Array
An array is a named variable that contains a list.
ASCII
American Standard Code for Information Interchange. The set of values from 0 - 127 which represent those symbols and control-codes normally used by American English terminals and display devices.
Binary operators
Operators that work on terms on both sides of the operator. For example, the addition, subtraction, multiplication, and division operators are all binary operators.
Block
A block is the basic aggregation of statements. A block is always enclosed in curly braces, except in the case of the main block. Semicolons are used to separate the statements in a block.
Built-in functions
The built-in functions are those functions that are a part of the Perl language. Unlike some other languages, these functions are not implemented in an external library; they are actually part of the language.
Character
A character is a byte (8 bits) of data, normally representing a displayable letter, number, or punctuation mark from the ASCII character set.
Compiler
A program that converts source code into another form that is then executed in a separate step.
Condition
A condition is a logical expression or statement that is being tested for true vs. false. A conditional construct is a way of deciding whether a given statement or block will be executed. In Perl, the conditional constructs are if, unless, and the ternary operator ( ? : ).
Cyborg
A cyborg (short for "cybernetic organism") is a theoretical or fictional being with both organic and bio-mechanical parts. The term was coined in 1960 by Manfred Clynes, Douglas C. Burks, and Nathan S. Kline. D. S. Halacy's Cyborg: Evolution of the Superman in 1965 featured an introduction which spoke of a "new frontier" that was "not merely space, but more profoundly the relationship between 'inner space' to 'outer space' a bridge...between mind and matter."
Declare
To declare a subroutine is to announce it exists in a program without actually initializing or defining it. When declare is used with reference to a variable, define is synonymous with initialize.
Else statement
An else statement is a conditional statement that follows an if statement and executes a condition is the preceding if statement is false. For example, the code
if($x == 7) { 
print "x is 7\n" 
} 
else { print "x is not 7\n" } 

will print out the string "x is not 7 only if x is not equal to 7.
Elsif statement
An elsif statement is a conditional statement that follows an if statement and allows another conditional branch to be made. For example, the code if($x == 7) { print "x is 7\n" } elsif($y == 10) { print "x is not 7, but y is 10\n" } will print out the string "x is not 7, but y is 10" only if x is not equal to 7 and y is equal to 10.
Expression
An expression is a collection of operators and operands that yields a result. For example, the expression 3 * 5 yields the result 15.
Flow control
Flow control is that part of a computer language that gives you control over the order in which the code is executed.
Function
A function is a reusable block of code with a name. A function can be defined with the sub keyword: sub foo { print "foo!\n" }
Greedy
Quantifiers are greedy by default. That is, they will match the maximum number of characters that will not break the expression. You can change any of them to become nongreedy by using a ? immediately after the quantifier.
Hash
A hash, or associative array, is an array that uses any scalar value as its subscript. Ordinary arrays must use a numeric subscript. Each hash element consists of a key and a value, sometimes called a key/value pair. The key is the index for finding the hash element, and the value is the actual value of the element. For the purpose of finding a given entry in the hash, the key is always construed as a string.
I/O
I/O is an abbreviation for input-output.
If statement
An if statment is a conditional statement that executes a block of code if a certain condition is met. for example, the code if($x == 7) { print "x is 7\n" } will only print out the string "x is 7" if the value of the variable $x is equal to 7.
Index
The index is the number associated with each item in the list. In Perl, indices start at zero. For example, in the statement $array[3]; the number 3 is the index. The term index is more often used in relation to hashes, where subscript is more often used in relation to arrays.
Initialize
To initialize a variable is to assign a value to it. For example: $x = 42; initializes x to 42.
Interpreter
A program that interprets source code and executes it without first converting it into a different form.
Keys operator
The keys operator returns a list of all the keys in a hash.
List
A list is an aggregation of scalars. In Perl, a list is represented by a number of scalars, separated by commas, all enclosed within a set of parentheses: (42, "foo", $bar, function)
Literal
A literal is a value entered in the source code explicitly. Literals can be either strings or numbers. For example, in the expression $x = 5 the number 5 is a literal.
Modifier
A modifier is a letter that's used at the end of the operator to modify the behavior of the match.
Nested block
A nested block is a block that is within other blocks.
Operator
An operator is a symbol (or a keyword) that operates on various terms to return a result. Operators can be unary, binary, or ternary. For example, in the expression a + b, the + symbol is the operator.
Operator precedence
Operator precedence are the rules that dictate which part of an expression with more one operator will be evaluated before other parts.
Operator terms
The term(s) of an operator are the various expressions on either or both sides of the operator that provide the values on which the operator operates.
Postfix
An operator or other device that follows the object of its operation. For example, the ++ and -- operators can be used either prefix or postfix, as can most of the flow control keywords.
Prefix
An operator or other device that precedes the object of its operation. For example, the ++ and -- operators can be used either prefix or postfix, as can most of the flow control keywords.
Scalar
A data type that stores all one-dimensional data, such as numbers or text.
Statement
A statement is a basically one task for the Perl interpreter to perform. A Perl program can be thought of as a series of statements. A statement can contain one or more expressions and is terminated by a semicolon.
String
A string is a literal enclosed in single or double quotation marks. Single quotation marks are used to represent the exact text of the literal string. Double quotation marks are used to interpolate the contents of the string.
Subexpression
A subexpression is part of a regular expression--usually a part that would provide some intermediate result and/or is within parenthesis.
Subroutine
A subroutine is another name for a function that you define as part of your program.
Subscript
In reference to arrays and lists, the subscript is the number associated with each scalar in the list. In Perl, subscripts start at zero. For example, in the statement $array[3]; the number 3 is the subscript.
Ternary operator
An operator that work on three terms. For example, the ? : operator works on three terms to evaluate a conditional statement. For example, in the statement $x = $a ? $b : $c the operator evaluates from left to right. First $a is evaluated. Then if $a is nonzero, $b is evaluated and returned. Otherwise, $c is evaluated and returned.
Type
Every value in Perl has several properties: is it scalar or list? Is it numeric or string? Does it have a name? These properties determine the type of the value.
Unary operators
Operators that work on terms on just one side of the operator. For example, the increment operator is a unary operator.
Values operator
The values operator returns all the values in the hash.
Variable
A variable is a named space for data with an address assigned to it. It's a place for the computer to store data and, using the address, retrieve it again. In Perl, a variable can be either a scalar, an array, or a hash.
While loop
A while loop continually executes an associated block of code, as long as the specified condition is true. The syntax of the while loop is while (CONDITION) {CODE BLOCK}. For example, (while $response < 700) {$newResponse == $response * 100; print$newResponse;} would continue to multiply the value of the variable $response by 100, assign that number to the variable $newResponse, and print out the value of $newResponse as long as the value of the $response is less than 700.

Regular Expressions