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
Why we use CGI?
What are the benefits of perl in using it as a web-based application?
Why does Perl not have overloaded functions?
What are scalars?
What is use of ‘->’ symbol?
How to concatenate strings in perl?
How to read from a pipeline with Perl
Write a program that shows the distinction between child and parent process?
How will you declare a variable in perl?
What are the steps involved when the cgi program starts running?
What are different data types that perl supports. Elaborate on them.
Explain string comparison operators in perl.
How can arrays be tied?
Does Perl have reference type?
What are the two ways to get private values inside a subroutine?