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

  • declare a variable x equal to 5

    my $x = 5;

    declare a string x equal to Mary

    my $x = 'Mary';

    declare an array a of the numbers 1,2,4

    my @a = (1, 2, 3);

    declare a hash h where a has key 1, b has key 2

    my %h = (1=>a, 2=>b);

    concatenate strings hello + world into s

    $s = 'hello'.'world';

    remove new line from string s


    get length of string s


    convert string to lower case


    get substring of s

    substr($s, start, len)

    join bob & mary by comma


    read one line from keyboard

    $x = <STDIN>;

    print hello world

    print "Hello world";

    start perl script

    use strict;
    use CGI ':standard';

    get all data from CGI using post

    @var = param();

    get name data from CGI using post

    $var = param('name');

    get 2nd and 3rd values from days array

    ($x, $y) = @days[1,2];

    remove last item in @days

    $last = pop(@days);

    remove first item in @days

    $first = shift(@days);

    sort @days alphabetically

    @sorted = sort(@days);

    reverse days array

    @rev = reverse(@days);

    get item with key 2 in data hash

    $item = $data{'2'};

    cycle through each element in hash %data

    while ( ($key, $val) = each (%data) ) {print "$key = $val";}

    if string equals yes

    if ($s eq 'yes')

    for each variable in array, print variable

    foreach $x (@array) { print "$x"; }

    size of array


    regex match with any capital letter


    regex letter followed by white space


    regex ABC first characters


    regex ABC last characters


    if x contains either A B or C

    if ($x ~= /[ABC]/)

    print date in $s = "Today is 17 May 2006"

    $s ~= /(\d+) (\w+) (\d+)/;
    print "$1 $2 $3";

    split string by comma into array

    @a = split /,/,$s;

    substitute bob for mary in string


    open file and print "hello"

    open (my $in, ">>file.txt");
    print $in "hello";
    close $in;

    open file.txt and read each line, printing to console

    open(my $in, "<file.txt");
    while (my $row = <$in>) { print "$row"; }
    close $in;

    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