How would you trap error occurred in the perl program/file?

Answer Posted / perly_whirly

Put your code inside of an eval. If an error occurs, the $@ variable will contain
the error. You can also raise an error by using die inside of an eval.

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain gmtime() function in perl?

561


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

525


What is the purpose of _package_ literal?

533


What does the qx{ } operator do?

505


What syntax is used for grep() function?

570






How many data types are there in perl?

531


What are the functions that can be performed using cgi program?

483


How to read file into hash array ?

571


How will you open a file in a write-only mode in perl?

476


What are the steps involved when the cgi program starts running?

506


Differentiate between arrays and list in perl.

534


Difference between the variables in which chomp function work ?

606


What does the q{ } operator do?

513


Write syntax to add two arrays together in perl?

542


Demonstrate subroutines in perl with a simple example.

466