Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Input/Output through the Keyboard

by Zaxo (Archbishop)
on Nov 13, 2002 at 02:46 UTC ( #212479=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://212479]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2022-11-28 19:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?