Long-Term Learning

Learn efficiently and remember over time.

Start Long-Term Learning

Get personalized study reminders at intervals optimized for better retention.
Track your progress on this set by creating a folder
Or add to an existing folder

Add this set to a folder

  • Identify the two phases of creating a PERL program

    1. Editing
    2. Execution

    Identify what modules are in perl

    - Synonymous with header files in C
    - Collection of like functions and variables that may be used in your program

    Identify how to include modules in perl

    use moduleName;
    Ex: use Roman;

    Identify the interpreters role in handling syntax errors

    - In perl, the interpreter will recognize syntax errors and halt execution BEFORE it begins
    - Interpreter will output statements; it does not understand and the line which it encountered the error on

    Identify the use of comments in perl

    - Documenting code
    - Created by placing a "#" on a line.
    - Comments are not multi-line

    Explain variable context in perl

    - can be scalar, array, or hash context
    - tells the interpreter what you are looking for (Ex: "$arrayname[$index_number]")

    Describe scalar variables in perl

    - Singular variable, starts with "$"
    - Number, characer or string
    - Perl does automatic type conversion of scalar variables

    Describe array variables in perl

    - A collection of data (static data, scalar variables, arrays or hashes can all be stored in an array element)

    Describe hash variables in perl

    - An associative array

    Explaing assignment of scalar variables in perl

    - Assigned using "="
    - Ex: $myVariable = 5;

    Summarize the siz arithmetic comparison operators


    Summarize the size string comparison operators


    Explain the use of "if" "if-else" and "if-elsif-else"

    There are also unless conditional flow-control statements

    Identify the purpose of {} in an "if" statement

    Define the execution block of the if statement. Unlike C, the {} braces ARE REQUIRED

    List the conditions which evaluate as false

    () -- arrays
    "" -- string
    EOF -- end of file

    Identify the four types of loops in perl


    Interpret the syntax of a while loop


    Interpret the syntax of the foreach loop

    foreach $element(@arrayName)

    In this case $element is a reference to a specific element of @arrayName. If you change the value of $element, the value will change in the array as well

    Explain the assignment of arrays in perl

    @array=("el1", "el2", "el3", 16, 12);
    - Elements need not be similar data types
    - Arrays can be assigned or read in scalar context (Ex: $myArray[4] = 2)
    - Special array $#arrayName give value of last index available in the array. Ex an array of size 5 will have its $#arrayName = 4
    - scalar(@arrayName) returns the size of the array

    What does $#arrayName return

    The value of the last index of the array (NOT the data stored in that array element)

    What does scalar(@arrayName) return

    The size of the array names @arrayName

    Explain the @ARGV array in perl

    A special system variable used to pass arguments to script
    - Ex: perl ./ arg1 arg2
    --$ARGV[0] will be "arg1", $ARGV[1] will be "arg2"

    Identify the variable that provides the last index of an array


    Explain common array functions

    push(@array, $new Value)
    unshift(@array, $newValue)


    Removes the last element from the array

    push(@array, $newValue)

    Adds a new element to end of the array with value $newValue


    Removes the first element of the array

    unshift(@array, $newValue)

    Add a new element to the from of the array with the value $newwValue


    reverse the elements of the array


    Sort and array alphabetically

    Explain assignment of hash variables in perl (when oringally defining the hash)

    %hashname = (key1=>"value1", key2=>"value2", key3=>"Value3")

    Explain assignment of a hash variable for a single hash element

    $hashName{keyName}="Value to Add"

    Explain the %ENV hash array

    Stores information about the current users environment. You can print this from the command line using printenv

    Explain common hash functions



    returns all of the keys of the hash as an array


    returns all of the values of the hash as an array


    does the hash key with "keyName" exists


    returns a two element ray of the next key value pair; resultArray[0] is the key resultArray[1] is the value


    delete the hash entry with the key given


    swap keys for values and values for keys. Will cause issues if there are multiple hash entries with the same value

    Define the open() statement in perl

    open(FILEHANDLE, file_mode, "filename.txt")
    - file mode is either ">", "<" or ">>"; write, read and append respectively

    List the three basic file access modes of the open() function

    > write
    >> append
    < read

    Explain how to read a line from a file handle

    To get rid of the newline in $line, you could now chomp() (Ex: chomp($line);)

    Explain how to read an entire file into an array (one line per element)

    Again you could chomp this array to get rid of all the newlines (Ex chomp(@entireFile)

    Explain how to write to a filehandle

    print(FILEHANDLE "Data to output\n");

    Define the two primary methods of executing system commands in perl

    - system("command args")
    - `command args`

    Describe the system() function in perl

    - used to execute an external command
    -will output results of command to terminal
    - returns the exit status of the program that ran
    - use this for commands that you dont care about SAVING the output to a variable

    Describe the command substitution in perl

    - uses grave marks `command args`
    - returns the output of the command to the variable you specify
    - if $output = `command arg` the output is stored all in one variable (all lines seperated by \n)
    - if @output = `command arg` the output is stored with each line of the output as a different array element

    Define common string manipulation functions

    substr($string, $start, $numchars);
    join(':", @string)
    split(/\s/, $string)


    remove trailing newline


    remove trailing newline from each element in the array


    returns the length of the string including escape sequences


    returns a copy of the string as all upper case


    returns a copy of the string as all lower case


    returns a copy of the string with the first letter upper case


    returns a copy of the string with the first letter lower case

    split(/\s/, $string)

    split string into an array using spaces as delimeter

    join(':', @array)

    join the elements of the array seperating the elements with the ':' character

    substr($string, $startindex, $numchars)

    return the sub string starting at index $startindex and ending after $numchars chars in the string $string

    Two basic binding operators in regular expressions

    =~ Contains
    !~ Does not contain

    Regular Expression Quantifiers

    * - 0 or more characters
    + - 1 or more characters
    ? - 0 or 1 characters

    Regular Expression chararcter classes

    \w - alphanumeric word including underscor
    \d - digits 0-9
    \s any whitespace
    . - any character

    Please allow access to your computer’s microphone to use Voice Recording.

    Having trouble? Click here for help.

    We can’t access your microphone!

    Click the icon above to update your browser permissions above and try again


    Reload the page to try again!


    Press Cmd-0 to reset your zoom

    Press Ctrl-0 to reset your zoom

    It looks like your browser might be zoomed in or out. Your browser needs to be zoomed to a normal size to record audio.

    Please upgrade Flash or install Chrome
    to use Voice Recording.

    For more help, see our troubleshooting page.

    Your microphone is muted

    For help fixing this issue, see this FAQ.

    Star this term

    You can study starred terms together

    NEW! Voice Recording

    This is a Plus feature