Perl Scripting Interview Questions & Answers

Posted On:January 30, 2019, Posted By: Latest Interview Questions, Views: 1488, Rating :

Best Perl Scripting Interview Questions and Answers

Dear Readers, Welcome to Perl Scripting Interview Questions and Answers have been designed specially to get you acquainted with the nature of questions you may encounter during your Job interview for the subject of Perl Scripting. These Perl Scripting Questions are very important for campus placement test and job interviews. As per my experience good interviewers hardly plan to ask any particular questions during your Job interview and these model questions are asked in the online technical test and interview of many IT companies.

1) What are the two different types of data perl handles?

Perl handles two types of data they are

(i) Scalar Variables and

(ii) Lists

Scalar variables hold a single data item whereas lists hold multiple data items.

Interview Questions on Perl Scripting

2) What are scalar variables?

Scalar variables are what many programming languages refer to as simple variables. They hold a single data item, a number, a string, or a perl reference. Scalars are called scalars to differentiate them from constructs that can hold more than one item, like arrays.


3) Explain about lists?

A list is a construct that associates data elements together and you can specify a list by enclosing those elements in parenthesis and separating them with commas. They could themselves be arrays, hashes or even other lists. Lists do not have a specific list data type.


4) Name all the prefix dereferencer in perl?

The symbol that starts all scalar variables is called a prefix dereferencer. The different types of dereferencer are.

(i) $-Scalar variables

(ii) %-Hash variables

(iii) @-arrays

(iv) &-subroutines

(v) Type globs-*myvar stands for @myvar, %myvar.


5) Explain about an ivalue?

An ivalue is an item that can serve as the target of an assignment. The term I value originally meant a “left value”, which is to say a value that appears on the left. An ivalue usually represents a data space in memory and you can store data using the ivalues name. Any variable can serve as an ivalue.


6) How does a “grep” function perform?

Grep returns the number of lines the expression is true. Grep returns a sub list of a list for which a specific criterion is true. This function often involves pattern matching. It modifies the elements in the original list.


7) Explain about Typeglobs?

Type globs are another integral type in perl. A typeglob`s prefix derefrencer is *, which is also the wild card character because you can use typeglobs to create an alias for all types associated with a particular name. All kinds of manipulations are possible with typeglobs.


8) Is there any way to add two arrays together?

Of course you can add two arrays together by using push function. The push function adds a value or values to the end of an array. The push function pushes the values of list onto the end of the array. Length of an array can be increased by the length of list.


9) How to use the command shift?

Shift array function shifts off the first value of the array and returns it, thereby shortening the array by one element and moving everything from one place to the left. If you don’t specify an array to shift, shift uses @ ARGV, the array of command line arguments passed to the script or the array named @-.


10) What exactly is grooving and shortening of the array?

You can change the number of elements in an array simply by changing the value of the last index of/in the array $#array. In fact, if you simply refer to a nonexistent element in an array perl extends the array as needed, creating new elements. It also includes new elements in its array.


11) What are the three ways to empty an array?

The three different ways to empty an array are as follows:

1) You can empty an array by setting its length to a negative number.

2) Another way of empting an array is to assign the null list ().

3) Try to clear an array by setting it to undef, but be aware when you set to undef.


12) How do you work with array slices

An array slice is a section of an array that acts like a list, and you indicate what elements to put into the slice by using multiple array indexes in square brackets. By specifying the range operator you can also specify a slice.


13) What is meant by splicing arrays explain in context of list and scalar.

Splicing an array means adding elements from a list to that array, possibly replacing elements now in the array. In list context, the splice function returns the elements removed from the array. In scalar context, the splice function returns the last element removed.


14) What are the different types of perl operators?

There are four different types of perl operators they are:

(i) Unary operator like the not operator

(ii) Binary operator like the addition operator

(iii) Tertiary operator like the conditional operator

(iv) List operator like the print operator


15) Which has the highest precedence, List or Terms? Explain?

Terms have the highest precedence in perl. Terms include variables, quotes, expressions in parenthesis etc. List operators have the same level of precedence as terms. Specifically, these operators have very strong left word precedence


16. What is Perl Scripting?

Perl Scripting is one of the robust scripting languages in the IT market which is being used in “n” of fields. Perl is rich in finding Regular expressions and stands unique in all fields of application.

PERL is a scripting language. Since all scripting languages are interpreter based languages but not compiler based languages, we use for optimization of code in all application.


17. Why do we use PERL scripting?

We use PERL scripting because it is rich in all regular expressions and functional concepts, we can create our own rules to find out particular generalized pattern by using regular expression. PERL supports or compatible in almost 76+ Operating systems and supports more than 3000 modules, called as CPAN (Comprehensive Perl Archive Network) modules, can be downloaded free from


18. Why do you create an application for real time system in which processing speed is vital?

Perl is used in the following cases:

To process large text

When data manipulation is done by application

If you require fast developments expand to become libraries

To load database operations


19. Distinguish my and local?

The variables which are declared using “my” lives only in that particular block ion which they are declared and inherited functions do not have a visibility that are called in that block. The variables which are defined as “local” are visible in that block and they have a visibility in functions which are called in that particular block.


20. Why Perl patterns are not regular expressions?

Perl patterns have back references

By the definition, a regular expression should determine next state in finite automaton without extra money to keep in previous state. State machine is required by the pattern / ([ab] +) c1/ to remember old states. Such patterns are disqualified as being regular expressions in the term’s classic sense.