Perl Interview Questions And Answers

Perl interview questions and answers on advance and basic Perl with example so this page for both freshers and experienced condidate. Fill the form below we will send the all interview questions on Perl also add your Questions if any you have to ask and for apply in Perl Tutorials and Training course just send a mail on in detail about your self.

Top Perl interview questions and answers for freshers and experienced

What is Perl ?

Answer :

Questions : 1 :: what is PERL

Perl is a family of high-level, general-purpose, interpreted, dynamic programming languages. The languages in this family include Perl 5 and Perl 6Though Perl is not officially an acronym, there are...View answers

Questions : 2 :: Difference between the variables in which chomp function work ?

Scalar: It is denoted by $ symbol. Variable can be a number or a string. Array: Denoted by @ symbol prefix. Arrays are indexed by numbers. The namespace for these types of variables is different....View answers

Questions : 3 :: How can we create Perl programs in UNIX, Windows NT, Macintosh and OS/2 ?

“Emacs” or “vi” can be used in UNIX and in Windows NT we can use “notepad”. In Macintosh we can use MacPerl’s text editor or any other text editor and in...View answers

Questions : 4 :: Create a function that is only available inside the scope where it is defined ?

$pvt = Calculation(5,5); print("Result = $pvtn"); sub Calculation{ my ($fstVar, $secndVar) = @_; my $square = sub{ return($_[0] **...View answers

Questions : 5 :: How can i display all array element in which each element will display on next line in Perl ?

  @array_declared=('ab','cd','ef','gh'); foreach (@array_declared) { print "$_n";...View answers

Questions : 6 :: Which feature of Perl provides code reusability ? Give any example of that feature.

Inheritance feature of Perl provides code reusability. In inheritance, the child class can use the methods and property of parent class Perl Package Parent; Sub foo { print("Inside...View answers

Questions : 7 :: In Perl we can show the warnings using some options in order to reduce or avoid the errors. What are that options?

-The -w Command-line option: It will display the list if warning messages regarding the code. – strict pragma: It forces the user to declare all variables before they can be used using the...View answers

Questions : 8 :: Write the program to process a list of numbers?

The following program would ask the user to enter numbers when executed and the average of the numbers is shown as the output: Perl $sum = 0; $count = 0; print "Enter number: "; $num...View answers

Questions : 9 :: Does Perl have objects? If yes, then does it force you to use objects? If no, then why?

Yes, Perl has objects and it doesn’t force you to use objects. Many object oriented modules can be used without understanding objects. But if the program is too large then it is efficient for...View answers

Questions : 10 :: Can we load binary extension dynamically?

Yes, we can load binary extension dynamically but your system supports that. If it doesn’t support, then you can statically compile the extension.

Questions : 11 :: Write a program to concatenate the $firststring and $secondstring and result of these strings should be separated by a single space.

Syntax: $result = $firststring . ” “.$secondstring; Program: #!/usr/bin/perl $firststring = "abcd"; $secondstring = "efgh"; $combine = "$firststring...View answers

Questions : 12 :: How do I replace every TAB character in a file with a comma?

  perl -pi.bak -e 's/t/,/g'...View answers

Questions : 13 :: In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?

-w (argument shows warning) -d (use for debug) -c (which compile only not run) -e (which executes) We can also use combination of these like: -wd

Questions : 14 :: How many types of primary data structures in Perl and what do they mean?

The scalar: It can hold one specific piece of information at a time (string, integer, or reference). It starts with dollar $ sign followed by the Perl identifier and Perl identifier can contain...View answers

Questions : 15 :: Which functions in Perl allows you to include a module file or a module and what is the difference between them?

“use” 1. The method is used only for the modules (only to include .pm type file) 2. The included objects are verified at the time of compilation. 3. We don’t need to specify the...View answers

Questions : 16 :: How can you define "my" variables scope in Perl and how it is different from "local" variable scope?

    $test = 2.3456; { my $test = 3; print "In block, $test = $test "; print "In block, $:: test = $:: test "; } print "Outside the block, $test = $test...View answers

Questions : 17 :: Which guidelines by Perl modules must be followed?

In Perl, the following guidelines must follow by the modules: The file name of a module must the same as the package name. The name of the package should always begin with a capital letter. The...View answers

Questions : 18 :: How the interpreter is used in Perl?

Every Perl program must be passed through the Perl interpreter in order to execute. The first line in many Perl programs is something...View answers

Questions : 19 :: "The methods defined in the parent class will always override the methods defined in the base class". What does this statement means?

The above statement is a concept of Polymorphism in Perl. To clarify the statement, let’s take an example: [perl] package X; sub foo { print("Inside X::foon"); } package...View answers

Questions : 20 :: For a situation in programming, how can you determine that Perl is a suitable?

if you need faster execution the Perl will provide you that requirement. There a lot of flexibility in programming if you want to develop a web based application. We do not need to buy the license...View answers

Questions : 21 :: Write syntax to add two arrays together in perl?

1 @arrayvar=(@array1,@array2);   To accomplish the same, we can also use the push...View answers

Questions : 22 :: How many types of operators are used in the Perl?

Arithmetic operators +, – ,* Assignment operators: += , -+, *= Increment/ decrement operators: ++, — String concatenation: ‘.’ operator comparison operators: ==, !=,...View answers

Questions : 23 :: If you want to empty an array then how would you do that?

We can empty an array by setting its length to any –ve number, generally -1 and by assigning null list Perl use strict; use warnings; my @checkarray; if...View answers

Questions : 24 :: Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?

The command line arguments in Perl are stored in an array @ARGV. $ARGV[0] (the first argument) $ARGV[1] (the second argument) and so on. $#ARGV is the subscript of the last element of the @ARGV...View answers

Questions : 25 :: Suppose an array contains @arraycontent=('ab', 'cd', 'ef', 'gh'). How to print all the contents of the given array?

  Perl @arraycontent=(‘ab’, ‘cd’, ‘ef’, ‘gh’) foreach (@arraycontent) { print...View answers

Questions : 26 :: What is the use of -w, -t and strict in Perl?

When we use –w, it gives warnings about the possible interpretation errors in the script. Strict tells Perl to force checks on the definition and usage of variables. This can be invoked using...View answers

Questions : 27 :: Write a program to download the contents from website in Perl.

Perl #!/usr/bin/perl use strict; use warnings; use LWP::Simple; my $siteurl = ''; my $savefile = 'content.kml'; getstore($siteurl,...View answers

Questions : 28 :: 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...View answers

Questions : 29 :: List the data types that Perl can handle?

Scalars ($): It stores a single value. Arrays (@): It stores a list of scalar values. Hashes (%): It stores associative arrays which use a key value as index instead of numerical...View answers

Questions : 30 :: Write syntax to use grep function?

  Perl grep BLOCK LIST grep (EXPR, LIST) 1 2 3 grepBLOCK...View answers

Questions : 31 :: What is the use of -n and -p options?

The -n and -p options are used to wrap scripts inside loops. The -n option makes the Perl execute the script inside the loop. The -p option also used the same loop as -n loop but in addition to it,...View answers

Questions : 32 :: What is the usage of -i and 0s options?

The -i option is used to modify the files in-place. This implies that Perl will rename the input file automatically and the output file is opened using the original name. If the -i option is used...View answers

Questions : 33 :: Write a program that explains the symbolic table clearly?

In Perl, the symbol table is a hash that contains the list of all the names defined in a namespace and it contains all the functions and variables. For example: Perl sub...View answers

Questions : 34 :: How can you use Perl warnings and what is the importance to use them?

The Perl warnings are those in which Perl checks the quality of the code that you have produced. Mandatory warnings highlight problems in the lexical analysis stage. Optional warnings highlight cases...View answers

Questions : 35 :: Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement?

for ($count = 10; $count >= 1; $count--) { print "$count "; } 1 2 3 4 5 6 7 for($count=10;$count>=1;$count--)   {   print"$count...View answers

Questions : 36 :: How can you replace the characters from a string and save the number of replacements?

  Perl #!usr/bin/perl use strict; use warnings; my $string="APerlAReplAFunction"; my $counter = ($string =~ tr/A//); print "There are $counter As in the given...View answers

Questions : 37 :: How can information be put into hashes?

When a hash value is referenced, it is not created. It is only created once a value is assigned to it. The contents of a hash have no literal representation. In case the hash is to be filled at once...View answers

Questions : 38 :: Why Perl aliases are considered to be faster than references?

In Perl, aliases are considered to be faster than references because they do not require any dereferencing.

Questions : 39 :: What do you mean by context of a subroutine?

It is defined as the type of return value that is expected. You can use a single function that returns different values.

Questions : 40 :: List the prefix dereferencer in Perl.

$-Scalar variables %-Hash variables @-arrays &-subroutines Type globs-*myvar stands for @myvar, %myvar.

Questions : 41 :: In CPAN module, name an instance you use.

In CPAN, the CGI and DBI are very common packages

Questions : 42 :: What are the advantages of c over Perl?

There are more development tools for C than for PERL. PERL execute slower than C programs. Perl appears to be an interpreted language but the code is complied on the fly. If you don’t want...View answers

Questions : 43 :: "Perl regular expressions match the longest string possible". What is the name of this match?

It is called as “greedy match” because Perl regular expressions normally match the longest string possible.

Questions : 44 :: How can you call a subroutine and identify a subroutine?

‘&myvariable’ is used to call a sub-routine and ‘&’ is used to identify a sub-routine.

Questions : 45 :: What is use of '->' symbol?

In Perl, ‘->’ symbol is an infix dereference operator. if the right hand side is an array subscript, hash key or a subroutine, then the left hand side must be a...View answers

Questions : 46 :: Where do we require 'chomp' and what does it mean?

We can eliminate the new line character by using ‘chomp’. It can used in many different scenarios.For example: Perl FstArgu. $argu = $ARGV[0]; chomp $argu;...View answers

Questions : 47 :: What does the'$_' symbol mean?

The ‘$_’ is a default variable in Perl and $_ is known as the “default input and pattern matching space

Questions : 48 :: What interface used in PERL to connect to database? How do you connect to database in Perl?

We can connect to database using DBI module in Perl. Perl use DBI; my $dbh = DBI->connect(’dbi:Oracle:orcl’, ‘username’,...View answers

Questions : 49 :: What is PERL? What is the basic command to print a String in Perl?

Perl is a programming language designed for text processing. It runs on various platforms Windows, Mac OS and various versions of UNIX.   To print a string, you need to observe the following...View answers

Questions : 50 :: List the operator used in Perl?

Operators used in Perl are   String Concatenation à ‘.’ Comparison Operators à ==, !=, >,< , >= Logical Operators à &&, ll , ! Assignment...View answers

Questions : 51 :: Explain which feature of PERL provides code reusability?

To provide code re-usability in PERL inheritance feature is used. In Inheritance, the child class can use the methods and property of the parent class.

Questions : 52 :: Mention the difference between die and exit in Perl?

Die will print a message to the std err before ending the program while Exit will simply end up the program.

Questions : 53 :: In Perl, what is grep function used for?

To filter the list and return only those elements that match certain criteria Perl grep function is used.

Questions : 54 :: What is the syntax used in Perl grep function?

a) grep BlOCK LIST b) grep ( EXPR, LIST )   BLOCK: It contains one or more statements delimited by braces, the last statement determines in the block whether the block will be evaluated...View answers

Questions : 55 :: Explain what is the scalar data and scalar variables in Perl?

Scalar in Perl means a single entity like a number or string. So, the Java concept of int, float, double and string equals to perls scalar and the numbers and strings are exchangeable. While scalar...View answers

Questions : 56 :: What does -> symbol indicates in Perl?

In Perl, the arrow – > symbol is used to create or access a particular object of a class.
More Question

Ask your interview questions on Perl

Write Your comment or Questions if you want the answers on Perl from Perl Experts
Name* :
Email Id* :
Mob no* :
Comment* :

--------- Tutorials ---