scalar keyword in Perl is used to convert the expression to scalar context. This is a forceful evaluation of expression to scalar context even if it works well in list context.
Syntax: scalar expr
Returns: a scalar value
Array in List form: Geeks For Geeks 1 1 0 0 9 6 Array in scalar form: 3 6
Concatenation of Arrays: Welcome To Geeks 1 1 0 0 9 6 Difference in number of elements: 3
- Perl | Scalar Context Sensitivity
- Perl | STDIN in Scalar and List Context
- Perl | Hash in Scalar and List Context
- Perl | my keyword
- Perl | Basic Syntax of a Perl Program
- Perl Tutorial - Learn Perl With Examples
- Perl vs C/C++
- Perl | each() Function
- Perl | chr() Function
- Perl | cmp Operator
- Perl | le operator
- Perl | gt operator
- Perl Hash
- Recursion in Perl
- Perl | next operator
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.