CARVIEW |
- #return EXPR
- #return
-
Returns from a subroutine,
eval
,do FILE
,sort
block or regex eval block (but not agrep
,map
, ordo BLOCK
block) with the value given in EXPR. Evaluation of EXPR may be in list, scalar, or void context, depending on how the return value will be used, and the context may vary from one execution to the next (seewantarray
). If no EXPR is given, returns an empty list in list context, the undefined value in scalar context, and (of course) nothing at all in void context.(In the absence of an explicit
return
, a subroutine,eval
, ordo FILE
automatically returns the value of the last expression evaluated.)Unlike most named operators, this is also exempt from the looks-like-a-function rule, so
return ("foo")."bar"
will cause"bar"
to be part of the argument toreturn
.
Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via the GitHub issue tracker or email regarding any issues with the site itself, search, or rendering of documentation.
The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the Perl issue tracker, the mailing list, or IRC to report any issues with the contents or format of the documentation.