http://qs321.pair.com?node_id=212479


in reply to Input/Output through the Keyboard

The keyboard input is captured on STDIN:

#!/usr/bin/perl use warnings; use strict; my $input; print("Your number: "), chomp( $input = <STDIN> ) until $input =~ /^\d+$/; print 3 * $input - 1, $/;

The print, chomp sequence uses the comma operator to make the two part of a single expression for the modifier. The alternative is do { print... ; chomp ...;} until ...;.

After Compline,
Zaxo