How would you trap error occurred in the perl program/file?
Answer Posted / shah faisal
#Ist trapping the error in a block
eval {
# perl code goes here
};
if ($@) { # $@ is a special variable containing the error
if any else blank
print "Print your own error If u want";
}
# 2nd
# use if or unless for a loop ;ike below
if(chk some condition)
{
die"$!\n"; # if the condition success
}
system generated error is printed and the scirpt is exited
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is confess function in perl?
Explain chop?
What exactly is grooving and shortening of the array?
Explain tk?
What is -> symbol in perl?
Explain USE and REQUIREMENT statements?
What are the various advantages and disadvantages of perl?
Explain regular expression in perl?
Differences between die and exit.
Can inheritance be used in perl? Explain with the help of an example.
Which functions in perl allows you to include a module file.
How will you get the count of parameters passed to a perl subroutine?
How will you create a file in perl?
What is the function of virtual documents in cgi programs?
Write a script to reverse a string without using perl's built in functions?