start page | rating of books | rating of authors | reviews | copyrights

Programming Perl

Programming PerlSearch this book
Previous: 3.2.190 waitpid Chapter 3
Functions
Next: 3.2.192 warn
 

3.2.191 wantarray

wantarray

This function returns true if the context of the currently executing subroutine is looking for a list value. The function returns false if the context is looking for a scalar. Here's a typical usage, demonstrating an "unsuccessful" return:

return wantarray ? () : undef;

See also caller . This function should really have been named "wantlist", but we named it back when list contexts were still called array contexts.


Previous: 3.2.190 waitpid Programming Perl Next: 3.2.192 warn
3.2.190 waitpid Book Index 3.2.192 warn