List vs. scalar context in Perl.


In Perl, the context (list or scalar) determines what an expression returns. This often leads to surprises – and is also very powerful.

Global regex match in list vs. scalar context:

wantarray to detect the caller's context: