Context

Context is a very important concept in Perl. There are two main contexts: scalar and list. Context usually affects how the functions and variables behave. This is close to the natural language.

The most popular usage is getting an array length for example. Normally when you use array in list context it returns all its elements, but when used in scalar context it returns its length.

my @array = (1, 2, 3);

my @array2 = @array; # list context
say @array2;

my $length = @array; # scalar context
say $length;