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
If you want to empty an array then how would you do that?
What is confess function in perl?
what is the function that is used to identify how many characters are there in a string?
Explain substr function in perl?
explain the various functions/directives in perl that allow you to include/import a module. Also, state the differences between them.
What is grep used for in perl?
Explain ivalue in perl?
What is q (single q) operator in perl?
What is the use of now constructor in perl?
Comment on the scope of variables in perl.
We all know private variables exist in perl. But do private METHODS exist in perl ? Eg ?
Where do we require ‘chomp’ and what does it mean?
When do you use perl programming?
What exactly is grooving and shortening of the array?
What are scalars?