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
List the prefix dereferencer in Perl.
How will you get the count of parameters passed to a perl subroutine?
Write a cgi program to show the header part?
What are the advantages of perl programming?
How we can navigate the xml documents?
How can you replace the characters from a string and save the number of replacements?
You want to download the contents of a url with perl. How would you do that?
How to add elements in a hash in perl?
how to connect cisco switch uisng perl script
Explain what is lvalue?
You want to empty an array. How would you do that?
How do you you check the return code of a command in perl?
How do I debug a perl program?
What are the various file operations in perl. Explain with example.
Explain chomp?