Nitin Jain
Nitin Jain

Reputation: 1

Perl_Function and subroutine

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

Answers (1)

Krishnachandra Sharma
Krishnachandra Sharma

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

Related Questions