Covid-19 Update!!    We have enabled all courses through virtual classroom facility using Skype or Zoom.    Don't stop learning.    Enjoy Learning from Home.

30% Discount Python        30% Discount Webdesign        30% Discount SEO        30% Discount Angular8        Free SQL Class        Free Agile Workshop       Free HTML Sessions        Free Python Basics

Important Perl Interview Questions and Answers

Interview Questions and Answers for Perl Scripting

1. 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. For Example: @add, $add. The scalar variables are in one table of names or namespace and it can hold single specific information at a time and array variables are in another table of names or namespace. Scalar variables can be even a number or a string

2. 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 shows the list if warning messages about the code.
Strict pragma: It forces the user to declare all variables before they can be used using the () function.
Using the built-in debugger: It permits the user to scroll through the entire program line by line.

3. Can we load binary extension dynamically?

By statically assemble the extension or through system we can load binary extension dynamically.

4. 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

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

    “use”
  • “use” is only for the modules to include .pm type file
  • The objects are certified at the time of collection.
  • We don’t need to specify the file extension.
  • loads the module at compile time.
    “require”
  • The method is used for both libraries and modules.
  • The included objects are verified at the run time.
  • We need to specify the file Extension.
  • Loads at run-time.
    suppose we have a module file as “Module.pm” use Module; or require “Module.pm”; (Will do the same)

    6. Which guidelines by Perl modules must be followed?

    Below are guidelines and are not mandatory
  • The package name should always begin with a capital letter.
  • The entire file name should have the extension “.pm”.
  • In case no object oriented technique is used the package should be derived from the Exporter class.
  • Through the @EXPORT and @EXPOR_OK arrays Perl module must spread its functions and variables to the main namespace, if no object oriented performance are used.

    7. For a situation in programming, how can you determine that Perl is a suitable?

    When we need faster execution, then Perl will provide us that requirement. There a lot of flexibility in programming if we want to develop a web based application. We do not need to buy the license for Perl because it is free. We can use Comprehensive Perl Archive Network, which is one of the largest depot of free code in the world.

    8. How many types of operators are used in the Perl?

                      
      Arithmetic operators
      +, – ,*
      Assignment operators:
      += , -+, *=
      Increment/ decrement operators:
      ++, —
      String concatenation:
      ‘.’ operator
      comparison operators:
      ==, !=, >, < , >=
      Logical operators:
      &&, ||, !
      

    9. What is the use of -w, -t and strict in Perl?

    The use –w is, it shows warnings about the possible interpretation errors in the script.
    Strict tells Perl to force checks on the meaning and usage of variables, which made the use strict command. If there are any unsafe commands in the script, this pragma stops the performance of the script instead of giving notice.
    The use –t is, it switches on taint checking and forces Perl to check the origin of variables where outside variables cannot be used in sub shell executions and system calls

    10. Which has the highest precedence, List or Terms? Explain?

    The Terms and List has the highest precedence in Perl. Terms involves variables, quotes, expressions in parenthesis etc. Mainly, these operators have very strong left word precedence.