How can I implement the function overloading in Perl ? I
read about the operator overloading, I do not know how to
implement the function overloading. Thanks in advance ?



How can I implement the function overloading in Perl ? I read about the operator overloading, I do ..

Answer / Jyoti Shukla

In Perl, you cannot directly implement function overloading like some other programming languages such as C++ or Java. However, you can achieve a similar effect using subroutine renaming and polymorphism. You can create multiple subroutines with the same name but different numbers and types of arguments, and then use Perl's dynamic dispatch mechanism to call the correct subroutine based on the argument list provided.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

What are the different types of perl operators?

1 Answers  


Write a program that shows the distinction between child and parent process?

1 Answers  


Why do you program in Perl?

4 Answers  


my @array=('data1','data2'); my @array1=('data1','data2'); my ($i,$k); $i=7; $k=7; while($i){ $array [++$#array] = 'ree'; $i--; print "@array"; } while($k){ push(@array1,'ree'); $k--; print "@array1"; } Are these two while loop are doing the same functionality ? What may be the difference?

1 Answers   A1 Technology,


When does circular reference occur?

1 Answers  


What elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?

1 Answers  


What is the importance of perl warnings? How do you turn them on?

1 Answers  


how to install a package in perl ????

2 Answers  


Explain the difference between use and require?

5 Answers   Aspire,


Which web site will help the student to download the Java mini Project ?

3 Answers  


What does redo statement do in perl?

1 Answers  


What is a hash?

6 Answers   Photon, Satyam, Wipro,


Categories