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

Mention what is cpan?

950


List the data types that Perl can handle?

965


How does a “grep” function perform?

965


How will you declare a variable in perl?

918


List the prefix dereferencer in Perl.

878


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

941


What is perl shift array function?

900


Explain what is STDIN, STDOUT and STDERR?

970


Differentiate use and require?

881


what is Chop & Chomp function does?

935


What is the function of cgiwrap in cgi programming?

866


How can you call a subroutine and identify a subroutine?

939


What is epoch time in perl?

875


What are the two ways to get private values inside a subroutine?

822


What $! In perl?

907