Home
1.
What are the two types of data you can use in Perl?

The two types of data you can use in Perl are scalar data, for individual things such as numbers and strings and list data, for collective things such as arrays.

2.
Is it possible to enter more than one debugging command at a time?

No,Its not possible. however, there is no real need to do so. If we want to perform several single steps at once,we can use the C command to skip ahead to a specified point. If we want to both step ahead and print the value of a variable,just use the command

3.
How can I convert to a reusable breakpoint a one-time breakpoint created using c?

By default, the b command sets a breakpoint at the line that is about to be executed. This is the line at which C has set its one-time breakpoint.

4.
Is it possible to examine variables in one package while inside another?

Yes. Use the V command or the standard Perl package/variable syntax

5.
Why does a file included by requireneed to execute a statement? Why does require check a return code?

Because files included by require can contain statements that are immediately executed, checking for a return code enables programs to determine whether code included by require generated any errors

6.
Define the terms pattern matching and regular expressions

pattern matching is the concept on Perl of writing a pattern which is then applied to a string or a set of data. Regular expressions are the language you use to write patterns.

7.
What sort of tasks is pattern matching useful for? Name three.

There are many uses of pattern matching—you are limited only by your imagination.
A few of them include
a. Input validation
b. Counting the number of things in a string
c. Extracting data from a string based on certain criteria
d. Splitting a string into different elements
e. Replacing a specific pattern with some other string
f. Finding regular (or irregular) patterns in a data set

8.
What do each of the following patterns do?
/ice\s*cream/
/\d\d\d/
/^\d+$/
/ab?c[,.:]d/
/xy|yz+/
/[\d\s]{2,3}/
/"[^"]"/

The answers are as follows:
a. This pattern matches the characters "ice" and "cream," separated by zero or more whitespace characters.
b. This pattern matches three digits in a row
c. This pattern matches one or more digits on a line by themselves with no other characters or whitespace.
d. This pattern matches ‘a', and optional 'b', a c, one of a comma, period, or colon, and a 'd'. "ac.d" will match, as will "acb,d", but not "abcd"
e. This pattern will match either 'xy' or ‘y' with one or more 'z's.
f. This pattern will match either a digit or a whitespace character appearing at least two but no more than three times.
g. This pattern matches all the characters in between opening and closing quotes

9.
What is the rule for how backreferences and match variables are numbered?

Backreferences and match variables are numbered based on opening parentheses. Parenthesized patterns can be nested inside each other.

10.
How long do the values of match variables stay around?

Match variables are extremely transient; their values only stay set until the next pattern match or until the end of a block.