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

Explain the default scope of variables in perl?

993


How to do comment in perl?

1003


What is the peculiarity of returning values by subroutines in perl?

960


How to prevent file truncation in perl?

1077


How to copy a file in perl?

1048


What are the arguments and what do they mean in perl programming?

1047


you are required to replace a char in a string and store the number of replacements. How would you do that?

975


What are the advantages and disadvantages of perl language?

968


What are some common methods to all handles in perl?

974


What is “grep” function in perl?

1068


Which functions in Perl allows you to include a module file or a module and what is the difference between them?

1092


What is use of ‘->’ symbol?

1056


Explain the difference between "my" and "local" variable scope declarations. ?

1135


What does read () command do?

975


Explain about the applications of perl?

1015