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 can you create an object of a class in a package?

Answer Posted / sh faisal

package Test;

sub new
{
$class = shift;
$self = {};

bless $self,$class; # By Mistake earlier i wrote it as
#$ref
return $self;
}
1;
# In perl Script

use Test; # Include the module you have created
$obj=new Test; # creating an onject of Class Test

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

There are two types of eval statements i.e. Eval expr and eval block. Explain them.

1096


Explain '->' in perl?

974


Explain chop?

966


How to deleting an existing file in perl programming?

949


What is the purpose of “_file_ literal” and “_line_ literal” in perl?

960


What is qq (double q)operator in perl?

1059


What does file test operators do in perl?

986


What are hashes?

994


What is the difference between use and require in perl?

913


You want to read command-line arguements with perl. How would you do that?

950


How can arrays be tied?

960


Why to use perl?

998


What are the reasons that cookie server can’t handle multiple connections?

989


How to add elements in a hash in perl?

967


Explain what is lvalue?

1072