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 package you use to create a windows services?
Define say() function in perl?
You want to connect to sql server through perl. How would you do that?
Show the use of sockets for the server and client side of a conversation?
There are some duplicate entries in an array and you want to remove them. How would you do that?
You want to read command-line arguements with perl. How would you do that?
Explain returning values from subroutines?
Which has the highest precedence, List or Terms? Explain?
How do you find the length of an array?
How do you set environment variables in perl?
Comment on the scope of variables in perl.
what is the main function of fork() in cgi programming?
Write syntax to add two arrays together in perl?
How to convert arrays into a string in perl?
How to print escaping characters inside a string in perl?