Perl Interview Questions and Answers
Question - 91 : - What does 'do' statement do in Perl?
Answer - 91 : -
The "do statement" is used in Perl database. It is a shortcut to perform all the CRUD operation. If it is succeeded, it returns true, otherwise false.
Question - 92 : - What is Perl DBI?
Answer - 92 : -
DBI stands for Database Independent Interface. In Perl, the database is accessed using DBI module. It is a third party module provided by CPAN. It supports all the major database systems. It provides an abstraction layer between Perl code and database.
Question - 93 : - What is eval function in Perl?
Answer - 93 : -
The eval function is a built-in function in Perl which is used to detect the normal fatal error. It is supplied with a code block instead of passing into a string.
Question - 94 : - What is confess function in Perl?
Answer - 94 : -
The confess function is used within the Carp standard library for error handling.
Question - 95 : - What is warn function in Perl?
Answer - 95 : -
The warn function gives the warning on encountering an error but does not exit the script. The Script keeps on running.
Question - 96 : - What $! in Perl?
Answer - 96 : -
The $! is a built-in error reporting variable in Perl. It tells us the reason for the error and prints it. It prints what the operating system tells it.
Question - 97 : - Explain the difference between die and exit in Perl?
Answer - 97 : -
The die function prints the standard error message then exits the program. Whereas, the exit function terminates the program without giving any error message.
Question - 98 : - What does a die() function do in Perl?
Answer - 98 : -
Perl die() function gives us a proper error message. It immediately terminates the script on encountering an error.
Question - 99 : - What is a chomp() function in Perl?
Answer - 99 : -
Perl chomp() function removes any newline character from the end of the string. It returns the number of characters removed from the string.
Question - 100 : - What is a chop() function in Perl?
Answer - 100 : -
Perl chop() function removes the last character from a string regardless of what that character is. It returns the chopped character.