How can you create an object of a class in a package?
Answer Posted / shah faisal
package Test;
sub new
{
$class = shift;
$self = {};
bless $ref,$class;
return $ref;
}
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 ? | 2 Yes | 3 No |
Post New Answer View All Answers
How to merge two arrays in perl?
Hi, I am a accountant. I am preparing a balance sheet but because of staff shortage and time pressures I cant complete it on time. There is lot of common data with last years which I need not retype and I can manage by editing last year’s balance sheet ? Is their any software on net where I can do this easily??
What does a die() function do in perl?
Explain what is STDIN, STDOUT and STDERR?
Explain regular expression in perl?
How many data types are there in perl?
What is Perl?
How will you open a file in read-only mode in perl?
Explain '->' in perl?
Why Perl aliases are considered to be faster than references?
What are the steps involved in configuring a server using cgi programming?
How to read a file into a hash array?
How can you replace the characters from a string and save the number of replacements?
How do you give functions private variables that retain their values between calls?
Can we load binary extension dynamically?