PERL Interview Questions & Answers

PERL Interview Online Test

PERL technical interview questions and answers are useful for candidates applying for scripting, automation, and system administration roles. PERL is widely used in text processing, network programming, automation scripts, and backend development, making it a common interview topic in IT companies. Recruiters from TCS, Wipro, Infosys, Cognizant, Capgemini, and Accenture often test candidates on PERL basics, syntax, regular expressions, arrays, hashes, file handling, subroutines, and modules. This guide provides clear explanations and examples for the most important PERL interview questions. Whether you are preparing for campus placements or experienced-level interviews, this resource will help you strengthen your scripting knowledge. You can also download PERL interview PDFs and practice mock questions to improve your performance.

1. Why do you use Perl?

Show Answer

2. How do I set environment variables in Perl programs?

Show Answer

3. Which of these is a difference between C++ and Perl?

Show Answer

4. What is Perl one-liner?

Show Answer

5. Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?

Show Answer

6. What happens when you return a reference to a private variable?

Show Answer

7. What are scalar data and scalar variables?

Show Answer

8. Why aren't Perl's patterns regular expressions?

Show Answer

9. What does Perl do if you try to exploit the execve(2) race involving setuid scripts?

Show Answer

10. How do you print out the next line from a filehandle with all its bytes reversed? print scalar reverse scalar

Show Answer

11. Why is it hard to call this function: sub y { "because" }

Show Answer

12. What does read() return at end of file?

Show Answer

13. What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)

Show Answer

14. How do you find the length of an array?

Show Answer

15. What value is returned by a lone `return;' statement?

Show Answer

16. What's the difference between /^Foo/s and /^Foo/?

Show Answer

17. How to dereference a reference?

Show Answer

18. What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?

Show Answer

19. If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}?

Show Answer

20. How do I do < fill-in-the-blank > for each element in an array?

Show Answer

21. How do I replace every character in a file with a comma?

Show Answer

22. When would `local $_' in a function ruin your day?

Show Answer

23. What happens to objects lost in "unreachable" memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), \$ap ]; }' ?

Show Answer

24. How do you match one letter in the current locale? /[^\W_\d]/

Show Answer

25. How do you give functions private variables that retain their values between calls?

Show Answer
Questions and Answers for Competitive Exams Various Entrance Test