Busy. Please wait.
or

show password
Forgot Password?

Don't have an account?  Sign up 
or

Username is available taken
show password

why


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
We do not share your email address with others. It is only used to allow you to reset your password. For details read our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

Remove Ads
Don't know
Know
remaining cards
Save
0:01
To flip the current card, click it or press the Spacebar key.  To move the current card to one of the three colored boxes, click on the box.  You may also press the UP ARROW key to move the card to the "Know" box, the DOWN ARROW key to move the card to the "Don't know" box, or the RIGHT ARROW key to move the card to the Remaining box.  You may also click on the card displayed in any of the three boxes to bring that card back to the center.

Pass complete!

"Know" box contains:
Time elapsed:
Retries:
restart all cards




share
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Common Perl Terms

Perl Symbols, Functions and Terminology

TermDefinition
# comment
@ array
$ standard (scalar) variable
% hash also called associative array contains key=>value pairs
defined($var) Tests whether the variable has been defined (i.e. a value assigned) or not.
undef($var) Undefines the variable.
my variable only exists block in which it was declared (and any sub-blocks).
local creates a local copy of a predefined variable within the block in which the local variable is declared. The pre-defined variable is not changed.
our global variable
Value/s interpreted as 'false' Any value that is evaluated as 0 or an empty string (i.e. "").
Value/s interpreted as 'true' Any value that does not evaluate to 0 or to an empty string (i.e. "")
gt String comparison operator: greater than Returns 1 for true, and empty string "" for false.
ge String comparison operator: greater than or equal to Returns 1 for true, and empty string "" for false.
lt String comparison operator: less than Returns 1 for true, and empty string "" for false.
le String comparison operator: less than or equal to Returns 1 for true, and empty string "" for false.
eq String comparison operator: equal to Returns 1 for true, and empty string "" for false.
ne String comparison operator: not equal to Returns 1 for true, and empty string "" for false.
cmp String comparison operator: comparison with signed result (-1 if left is less than right, 0 if they are equal, 1 if left is greater than right).
<=> Numeric comparison operator: comparison with signed result (-1 if left is less than right, 0 if they are equal, 1 if left is greater than right).
not lower precedence equivalent of !
and lower precedence equivalent of &&
or lower precedence equivalent of ||
unless inverse of an if statement
until inverse of a while loop equivalent to while(!<condition>) loop
1 .. 10 range operator (double dots) generates an increasing sequence of values within the specified range (inclusive)
foreach $var (@array) for loop that iterates through every element in a list or array $var holds the element value at each iteration @array is the list (or array) to be iterated
(keys %hash) a function which returns the keys of a hash as an array
last loop control statement equivalent to 'break' in other languages - terminates the loop immediately Any 'continue' block will not be executed.
next loop control statement equivalent to 'continue' in other languages - ignores the remaining statements in the block and skips directly to the next iteration of the loop. Any 'continue' block will be executed before the next loop iteration.
redo loop control statement restarts the block without re-evaluating the loop condition. Any 'continue' block will not be executed.
goto causes program execution to go directly to the named block avoid unless absolutely necessary!
continue a block can continue after another block block1 { ... } continue { ... }
LABEL a block (delimited by { and }) can be given a name (called a label) to enable it to be referred to elsewhere in the script
<> angle operator or readline function reads one line from the file handle specified between the angle brackets (defaults to STDIN if none is provided)
$_ hidden scalar variable - used a default variable for storing values when no variable is explicitly given
=~ binding operator binds a string to a regexp pattern
{{ ... }} bare block allows a non-loop block (e.g. if, unless, do) to be treated as a loop for the purposes of using the loop control statements: last, next and redo. Often used for constructing SWITCH statements as Perl does not have 'switch' or 'case' keywords
!~ binding operator, negation of =~
`...` command input operator backtick operator string enclosed between backticks is executed as a operating system (e.g. UNIX) command.
** exponentiation operator - 'to the power of' a ** b = a 'to the power of' b if a is negative, put it in parenthesis
-e File Test Operator: file exists?
-s File Test Operator: file size
-r File Test Operator: file is readable?
-w File Test Operator: file is writable?
-x File Test Operator: file is executable?
-f File Test Operator: file is a plain file?
-d File Test Operator: file is a directory?
-T File Test Operator: file is a test file?
-B File Test Operator: file is a binary file?
-M File Test Operator: age of a file since modification
-A File Test Operator: age of a file since last access
-C File Test Operator: age of a file since creation
open(FILEHANDLE, filename) attempts to open specified file, FILEHANDLE is used like a variable to refer to that file from that point on Returns a false value if opening fails.
die(msg) prints msg to the console then terminates the program usually used when an error occurred that cannot be rectified - closes script gracefully
$#array is the index of the last element in the array +1 to get the array size (as array indicies start at 0)
$array[-1] accesses the last element in the array
scalar context expressions are expected to produce a scalar (single) value
list context expressions are expected to produce a list of values
pop @array removes (and returns) the last element from the array
push @array, list appends the 'list' to the end of the array
shift @array removes (and returns) the first element from the array
unshift @array, list inserts the 'list' at the beginning of the array
splice @array, offset, length, list replaces a section of @array (of 'length' elements) starting at position 'offset' with the elements in 'list' - if no 'list', deletes splice only - if no 'length', everything after 'offset' will be removed
splice equivalent of push(@a, $x, $y) splice(@a, @a, 0, $x, $y)
splice equivalent of pop(@a) splice(@a, -1)
splice equivalent of shift(@a) splice(@a, 0, 1)
splice equivalent of unshift(@a, $x, $y) splice(@, 0, 0, $x, $y)
Created by: acwablue