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
What are prefix dereferencer?
List all the features of perl programming?
How do you find the length of an array?
How to determine strings length in perl?
What exactly is grooving and shortening of the array?
How to read a file into a hash array?
Explain grooving and shortening of arrays?
Show the use of sockets for the server and client side of a conversation?
What does init 5 and init 0 do?
Differentiate between use and require, my and local, for and foreach and exec and system
Explain the use of 'my' keyword in perl?
What does the’$_’ symbol mean?
What does Perl do if you try to exploit the execve(2) race involving setuid scripts?
What does this symbol mean '->'?
What do you mean by context of a subroutine?