adspace


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 ?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is perl? What is the basic command to print a string in perl?

944


How do find the length of an array?

1215


There is no strict data types in perl unlike in other high level languages like Java so wouldn't that be a problem if a code in perl is to be a written by a big team of 20+ members ?"

2460


How to connect to SQL server through Perl?

1146