NAME

Question types


Start with


Question limit

of 39 available terms

Print test

39 True/False questions

  1. word anchor in regexThey're all double.

          

  2. what does 'state' do?static local variable.

          

  3. invoking a functionsub function {
    }

          

  4. 'package' keywordstatic local variable.

          

  5. How do you concatenate strings?sort <comparator_function_name> @array

          

  6. Perl numeric typesThey're all double.

          

  7. Getting user inputThey're all double.

          

  8. Perl Booleanmy @k = keys %hash
    my @v = values %hash

          

  9. array/scalar variables namespaceyes.

          

  10. accessing hash element$hash{$key}

          

  11. finding array lengthsub function {
    }

          

  12. What's the function that removes the endline in a string?$_

    Ex) foreach (1..3) { print "$_"; }

          

  13. String repetition operatorx

          

  14. 1) push into the front of the array
    2) pop out from the front of the array
    3) push into the back of the array
    4) pop out from the back of the array
    1) unshift
    2) shift
    3) push
    4) pop

          

  15. How do you use references in Perl?substr($string, $position, $length)

          

  16. How do you iterate through each element in an array?foreach (@array)

          

  17. my vs ourmy: just local variables
    our: declare global variables for a package

          

  18. each operatormy @k = keys %hash
    my @v = values %hash

          

  19. <> operator looks into what?@ARGV

          

  20. How do you get substring in perl?index($haystack, $needle)

          

  21. Perl string comparatoreq, ne, lt, gt, le, ge

          

  22. What's a slice?
    1) Array
    2) Hash
    $_

    Ex) foreach (1..3) { print "$_"; }

          

  23. What's the default variable?Pass by reference. When passed an array, it flattens the array and pass each element one by one.

          

  24. How do you get string index in perl?substr($string, $position, $length)

          

  25. foreach syntax@rocks = qw/ bedrock slate rubble granite /;
    while( my( $index, $value ) = each @rocks) {
    say "$index: $value";
    }

          

  26. What does qw do?You can use it to define a list.
    qw/ bedrock slate lava /

          

  27. Are strings mutable in perl?yes.

          

  28. hash to array@rocks = qw/ bedrock slate rubble granite /;
    while( my( $index, $value ) = each @rocks) {
    say "$index: $value";
    }

          

  29. Difference between single-quoted strings and double-quoted strings?single-quoted strings: other than \, nothing gets substituted.
    double-quoted strings: things get substituted.

          

  30. how does perl pass variables?Pass by reference. When passed an array, it flattens the array and pass each element one by one.

          

  31. defining a functionsub function {
    }

          

  32. List(1, 2, 3)
    (1..5)

          

  33. How do you see if a variable is defined?defined($var)

          

  34. What does splice do?You can use it to define a list.
    qw/ bedrock slate lava /

          

  35. what does this do: print <>;Remove/replace array elements in the middle.
    Ex) splice(@arr, 3, 2);
    Ex) splice(@arr, 3, 0, "new item");

          

  36. use vs. import vs. requireuse = calls import and then require
    import = loads symbols into the current namespace, so that you don't have to specify their package name each time
    require = loads symbols

          

  37. getting function arguments$_[0], $_[1], ...
    ($m, $n) = @_

          

  38. opening and using filehandlessub function {
    }

          

  39. How do you sort in perl?sort <comparator_function_name> @array