Logo

Programming-Idioms

History of Idiom 120 > diff from v3 to v4

Edit summary for version 4 by :
New Perl implementation by user [Roboticus]

Version 3

2016-02-07, 21:18:55

Version 4

2016-02-12, 11:36:00

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Code
my $n = <> + 0;  # read a line from STDIN, add 0 to convert to int