ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Scripts  >>  CGI Perl
 
 


 

 
 PHP interview questions  PHP Interview Questions
 ASP interview questions  ASP Interview Questions
 CGI Perl interview questions  CGI Perl Interview Questions
 JavaScript interview questions  JavaScript Interview Questions
 VB Script interview questions  VB Script Interview Questions
 JSP interview questions  JSP Interview Questions
 Shell Script interview questions  Shell Script Interview Questions
 Python interview questions  Python Interview Questions
 Tcl interview questions  Tcl Interview Questions
 Awk interview questions  Awk Interview Questions
 AJAX interview questions  AJAX Interview Questions
 Ruby on Rails interview questions  Ruby on Rails Interview Questions
 Scripts AllOther interview questions  Scripts AllOther Interview Questions
Question
How would you trap error occurred in the perl program/file?
 Question Submitted By :: Jay Mishra
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How would you trap error occurred in the perl program/file?
Answer
# 1
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 ?    0 Yes 1 No
Perly_whirly
 
  Re: How would you trap error occurred in the perl program/file?
Answer
# 2
You can catch the errros by using eval function.
Keep your code in eval block some thing like shown below.
Eg.,
#################################
eval {
my $a = 0;
my $b = $a/0;  #Dividing 0 with 0 is definitely an error
};

if ($@) {
print "\n Error in your code"; 
}


############################
-> Eval block always ends with a semi-colon. $@ will catch
the errors persent.

-> If any errors are present $@ will be set otherwise $@
will not be set

-> Unfortunately in Perl we don't have Explicit Error
handling techniques like some other languages like java etc
I mean like IOException etc.,
 
Is This Answer Correct ?    1 Yes 2 No
Prabhath Kota
 
 
 

 
 
 
Other CGI Perl Interview Questions
 
  Question Asked @ Answers
 
Why do you program in Perl?  1
what r the future opportunities in PERL/LINUX after 3 years ??  2
I have created a CGI-based page,after entering all the values in to the fields, How to get the output on the web browser using Perl  4
What purpose does each of the following serve: -w, strict, - T ?  2
What is the difference between for & foreach, exec & system? Photon3
Write a script for 'count the no.of digits using regular expressions in perl.. AppLabs4
What elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?  1
What do the symbols $ @ and % mean when prefixing a variable?  1
What?s your favorite module and why?  1
How would you trap error occurred in the perl program/file? IBM2
How to find out the version of PERL being installed on your LINUX machine. Mind-Tree3
Explain the difference between my and local?  1
When would you not use Perl for a project?  1
what is the procedure to define a user define module in your perl application? IBM1
Can any1 tell me 2 write the script using perl script 2 looking at a log file 2 see wheather the test has passed or not. TCS2
how to install a package in perl ????  1
How do you open a file for writing?  4
How can you create an object of a class in a package? IBM2
What are the characteristics of a project that is well suited to Perl?  1
what r the different type of function in perl ??? Symphony1
 
For more CGI Perl Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com