Logo

Programming-Idioms

History of Idiom 117 > diff from v52 to v53

Edit summary for version 53 by programming-idioms.org:
[Perl] Variable names n, x

Version 52

2020-07-29, 21:56:31

Version 53

2020-08-10, 17:35:02

Idiom #117 Get list size

Set n to the number of elements of list x.

Idiom #117 Get list size

Set n to the number of elements of list x.

Variables
n,x
Variables
n,x
Extra Keywords
length
Extra Keywords
length
Code
$size = scalar @list;
Code
$n = scalar @x;
Comments bubble
This is a recommended way, which ensures that any kind of list is in scalar mode, where only it's size is produced.
Comments bubble
This is a recommended way, which ensures that any kind of list is in scalar mode, where only it's size is produced.