Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How does polymorphism work in perl? Give an example.

808


What does delete function do in perl?

927


How are parameters passed to subroutines in perl?

887


What are scalar data and scalar variables?

1053


Write a program that shows the distinction between child and parent process?

870


what is Chop & Chomp function does?

935


Elaborate on perl bite-wise operators.

849


How will you get the count of parameters passed to a perl subroutine?

883


How will you create a file in perl?

915


How to open and read data files with Perl

990


How do you match one letter in the current locale?

955


Write the program to process a list of numbers.

918


What are numeric operators in perl?

900


What does init 5 and init 0 do?

948


What is the difference between use and require in perl programming?

870