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

Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?

1081


How many types of primary data structures in Perl and what do they mean?

1403


Why Perl aliases are considered to be faster than references?

943


Write an example explaining the use of symbol tables.

952


What is the use of -t?

958


what are the strategies followed for multiple form interaction in cgi programs?

936


What is cpan in perl?

943


What are scalars in perl?

947


What are prefix dereferencer?

917


Explain socket programming in perl?

907


List the files in current directory sorted by size ?

973


What is warn function in perl?

947


how to get back up from private character editor which is saved in the format of .udf

2282


Give an example of using the -n and -p option.

991


Define operators used in perl?

932