Programming-Idioms

History of Idiom 22 > diff from v47 to v48

Edit summary for version 48 :
[Perl] Fixed comment syntax

Version 47

2016-10-20, 11:42:45

Version 48

2016-10-20, 11:43:09

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Extra Keywords
int
Extra Keywords
int
Code
my $i = $s + 0;
Code
my $i = $s + 0;
Comments bubble
Perl automatically converts numbers to strings, and strings to numbers, whenever required.

_+ is addition, not concatenation.
Comments bubble
Perl automatically converts numbers to strings, and strings to numbers, whenever required.

+ is addition, not concatenation.