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 does last statement do in perl?
Explain the meaning of closure in perl.
List the operator used in Perl?
Explain string comparison operators in perl.
You want to concatenate strings with perl. How would you do that?
What are the various uses of perl?
Comment on data types and variables in perl.
What does cgi program store?
Explain goto expr?
What does next statement do in perl?
For a situation in programming, how can you determine that Perl is a suitable?
What is lexical variable in perl?
What is the main function of cookie server?
What is the different between array and hash in perl programming?
what is the main function of fork() in cgi programming?