Five Perl Interview Questions Every Programmer Must Know

perl interview questionsPerl is like the Gary Oldman of programming: understated and (apparently) unfashionable, but carrying the true weight of every project it’s in. Perl is everywhere: it’s used in system administration, network programming, and graphics programming. It’s also one of the most common languages used on the Unix platform, which, in turn, powers most web servers, making Perl the glue that holds the internet together.

Perl does not have any official acronym, although most people expand it to “Practical Extraction and Report Language”. It was created by Larry Wall while he was working for SDC in 1987. The official slogan for Perl is “There’s more than one way to do it”, which underlines Perl’s flexibility and power.

Just starting out? Learn the basics of Perl with the Beginning Perl Programming course!

Unlike more fashionable programming languages like Java, Python or Objective-C, Perl jobs are limited (it ranks no. 14 of 15 on JobsTractor’s monthly jobs list), but highly paying (average salary for Perl developer is $94,000 – $5,000 higher than a Java developer). Perl also has a reputation for attracting hardcore hackers, so be prepared for some tough questions in a Perl job interview.

Below, we’ve cobbled up some common questions routinely asked in Perl interviews:

1. List the programming guidelines that must be followed when programming with Perl modules:

  • The Module and the package name must be the same.
  • When referring to a package name, it must ALWAYS begin with a capital letter.
  • The only allowable package name needs to have the extension “.pm”.
  • The package must be derived from the exporter class when no object-oriented technique is used.
  • When no object-oriented techniques are used, the module must export all functions utilising the @EXPORT and @EXPOR_OK methods.

2. How is it determined if Perl is suitable for a programming need?

Perl is best used in programs that require rapid execution. Perl is also ideal for web-based applications that are defined by a certain amount of flexibility. As Perl is considered freeware, it is highly appropriate for programming needs that are under strict budgetary guidelines. One way to understand your programming needs is by using flowcharts and pseudocode. This course will teach you how to master flowcharting to become a better programmer.

3. List the number of operators used in Perl and describe them in syntax and symbolic form.

  • Logical operators. &&, ||, !
  • Comparison operators. ==, !=, >, < , >=
  • String concatenation. ‘.’
  • Assignment operators. += , -+, *=
  • Increment and decrement operators. ++, –
  • Arithmetic operators. +, – ,*

4. In the Perl operating language, what is the significance of the -w, -t and STRICT functions?

The -w is used to warn about the potential to misinterpret syntax that is located in the script.

The -t function is used to verify the origins of certain variables in instances when outside variables are unable to be used in system calls.

The STRICT command will verify the definition and usage of variables within the program. This is considered a step above the -w command, for if an unsafe or unverified variable is located, it will immediately stop the execution of the program as opposed to merely providing a warning.

Are you an entrepreneur? Learn the basics of programming with a free Coding for Entrepreneurs course!

5. What are some of the distinct advantages of Perl over C programming language?

As Perl and C share a number of characteristics, it isn’t common for interviewers to ask questions comparing the two languages.

Some of the distinct advantages of Perl over C are:

  1. Portability: A Perl program is platform independent and can run on any operating system, while C requires use of a cross-compiler to port code between operating system.
  2. Large Module Library: Perl has been in development for close to 30 years. This has helped create a huge library of free modules distributed under GNU Public License. These modules can be easily found on CPAN. With C, however, one has to write programs completely from scratch.
  3. Flexibility: Perl borrows elements from several programming languages, including C, FORTRAN, etc. This lends the language a lot of flexibility which is missing from C.
  4. Programmer First Approach: When C was originally developed, computer hardware was extremely expensive. When Perl was developed, software developers, and not hardware, were more expensive. Thus, Perl adopts a programmer-first approach, making efficient use of a programmer’s time.
  5. Dynamic Memory Allocation: It is possible to increase or decrease the size of a memory array at any point with Perl, making dynamic memory allocation extremely easy.

These are five of the most common questions that are important to understand when applying for a position that requires a strong knowledge of the PERL programming language. Thankfully, you can take a course like Learn Perl 5 by Doing It to grasp Perl programming concepts.

What other questions were you asked in your Perl job interview? Comment and share below!