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 perl strings?
Explain gmtime() function in perl?
what are the strategies followed for multiple form interaction in cgi programs?
Which has the highest precedence, List or Terms? Explain?
Mention the difference between die and exit in Perl?
How to connect with sqlserver from perl and how to display database table info?
Explain perl. When do you use perl for programming?
What is the use of "stderr()"?
Why do we use "use strict" in perl?
Write a cgi program to show the header part?
How to concatenate strings with perl?
There are some duplicate entries in an array and you want to remove them. How would you do that?
When does circular reference occur?
What happens in dereferencing?
List the data types that Perl can handle?