VOOZH about

URL: https://www.geeksforgeeks.org/perl/perl-return-function/

⇱ Perl | return() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Perl | return() Function

Last Updated : 7 May, 2019
return() function in Perl returns Value at the end of a subroutine, block, or do function. Returned value might be scalar, array, or a hash according to the selected context.
Syntax: return Value Returns: a List in Scalar Context
Note: If no value is passed to the return function then it returns an empty list in the list context, undef in the scalar context and nothing in void context. Example 1:
Output:
Return value is 250
Return value is 25 10 250
Example 2:
Output:
Return value is 15
Return value is 25 10 15
Comment

Explore