Home / Interview / Perl :: General Questions

Interview :: Perl

1)

What is Perl?

Perl stands for Practical Extraction and Reporting Language. It is a high-level programming language written by Larry Wall, specially designed for processing text. It supports object-oriented programming, and its syntax is quite similar to C language. It is much more flexible to use. Due to its strong text processing abilities, it has become one of the most popular languages for writing CGI scripts.

2) Is Perl Compiler or Interpreter?

Perl is said to be both compiler and interpreter. It reads the source code, converts the program into bytecode before execution and then runs it. Hence, Perl is sometimes called an interpreter/compiler.

3) Which operator in Perl is used for the concatenation of two strings?

The operator used for the concatenation of strings is (.) operator.

4) What is CPAN in Perl?

CPAN stands for Comprehensive Perl Archive Network. It is a repository which contains thousands of Perl modules.

5)

What are the features of Perl language?

The feature of Perl:

  • It has a very simple Object-oriented programming syntax.
  • It is easily extendible as it supports 25,000 open source modules.
  • It supports Unicode.
  • Includes powerful tools to process text to make it compatible with markup languages like HTML, XML.
  • It supports third-party database including Oracle, MySQL, and many others.
  • It is embeddable in other systems such as web servers and database servers.
  • It is open source software licensed under GNU.
  • Many frameworks are written in Perl.
  • It can handle encrypted web data including e-commerce transactions.
  • It is a cross-platform language.
  • It offers a regular expression engine which can transform any text.

6) What are the advantages and disadvantages of Perl language?

Perl advantages:

  • Its syntax is simple, which makes it easy to understand.
  • It supports OOP concepts.
  • Perl programs run easily on the system.
  • It is more flexible to use.
  • It supports all platforms and is much more portable.
  • It has a rich set of Perl modules and free software.
  • It is much more efficient to work on text and string manipulation as it is a scripting language.
  • Perl combines features of many other languages which make it easy to understand.
  • Perl disadvantages

  • A Perl program containing CPAN modules will not run on another system which doesn't have CPAN modules installed.
  • It is an interpretative language, so it is slower in comparison with other languages.
  • It has untidy and unreadable codes.
  • It starts creating problems when the code is larger than 200 lines.
  • It is not portable.
  • 7) Define print() function in Perl?

    The Perl print() function prints anything it gets as its argument.

    8) Define say() function in Perl?

    The Perl say() function is not supported by older Perl versions. It is like Perl print() function with only one difference that it automatically adds a new line at the end.

    9)

    Define dynamic scoping?

    The assignment of temporary values to the global variables is called as dynamic scoping.

    10)

    Explain lexical variables?

    The variables which are created by the use of 'my' operator and private in nature are called as lexical variables.