Logo

Programming-Idioms

History of Idiom 22 > diff from v46 to v47

Edit summary for version 47 by programming-idioms.org:
[Perl] Removed sample values

Version 46

2016-09-07, 21:10:40

Version 47

2016-10-20, 11:42:45

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 $s = "12";
my $i = $s + 13;   # Foo is now 25
Code
my $i = $s + 0;
Comments bubble
Perl automatically converts numbers to strings, and strings to numbers, whenever required.
Comments bubble
Perl automatically converts numbers to strings, and strings to numbers, whenever required.

_+ is addition, not concatenation.