How can you create an object of a class in a package?
Answer Posted / sh faisal
package Test;
sub new
{
$class = shift;
$self = {};
bless $self,$class; # By Mistake earlier i wrote it as
#$ref
return $self;
}
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 ? | 4 Yes | 0 No |
Post New Answer View All Answers
You want to concatenate strings with perl. How would you do that?
What does undef function in perl?
Write a script to reverse a string without using perl's built in functions?
What does delete function do in perl?
What is the use of -w, -t and strict in Perl?
Explain regular expression in perl?
Explain the meaning of closure in perl.
In Perl we can show the warnings using some options in order to reduce or avoid the errors. What are that options?
How to read a directory in perl?
How do you give functions private variables that retain their values between calls?
How to renaming a file in perl programming?
How will you create a file in perl?
Why we use CGI?
what is the difference between java and cgi?
What does cgi program store?