Reputation: 1
What is Difference between Function and subroutine in perl ? I found difference in few site, there i found Subroutine does not return value but function returns but actually Subroutine also return value . Please let me know What is Exact difference between Function and subroutine in perl ?
Upvotes: 0
Views: 89
Reputation: 1342
Generally in computer science a function is a special type of subroutine that returns a values (as opposed to being called just for its side-effects). But in Perl (as the cookbook says) we don't make that distinction.
The two words mean the same thing. They're synonyms.
Course: Perlmonks.
Update: They are synonyms only because Perl returns last value of expression, evaluated in sub-block.
Upvotes: 1